diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2014-10-02 18:42:54 +0200 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2014-10-05 18:21:11 +0200 |
commit | fa34901237cc244fe8b828d079af891e63de1c8f (patch) | |
tree | b165b52a7ff478d7338068caab39ae62b7b1d06e /features/steps/project/commits/user_lookup.rb | |
parent | ac71c386f98fa9b88381abbf9d20e79f57bd7957 (diff) | |
download | gitlab-ce-fa34901237cc244fe8b828d079af891e63de1c8f.tar.gz |
Make Spinach test names consistent
- do not add Feature to feature titles
- titleize feature titles
- put steps on the same path as .feature files
- make feature titles match their path
Diffstat (limited to 'features/steps/project/commits/user_lookup.rb')
-rw-r--r-- | features/steps/project/commits/user_lookup.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/features/steps/project/commits/user_lookup.rb b/features/steps/project/commits/user_lookup.rb new file mode 100644 index 00000000000..0622fef43bb --- /dev/null +++ b/features/steps/project/commits/user_lookup.rb @@ -0,0 +1,48 @@ +class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I click on commit link' do + visit project_commit_path(@project, sample_commit.id) + end + + step 'I click on another commit link' do + visit project_commit_path(@project, sample_commit.parent_id) + end + + step 'I have user with primary email' do + user_primary + end + + step 'I have user with secondary email' do + user_secondary + end + + step 'I see author based on primary email' do + check_author_link(sample_commit.author_email, user_primary) + end + + step 'I see author based on secondary email' do + check_author_link(sample_commit.author_email, user_secondary) + end + + def check_author_link(email, user) + author_link = find('.commit-author-link') + author_link['href'].should == user_path(user) + author_link['data-original-title'].should == email + find('.commit-author-name').text.should == user.name + end + + def user_primary + @user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com') + end + + def user_secondary + @user_secondary ||= begin + user = create(:user, email: 'dzaporozhets@example.com') + create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) + user + end + end +end |