diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-08-30 01:31:26 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-08-30 01:31:26 +0300 |
commit | 96e0020c70ba69de873067b092626295d8388bf0 (patch) | |
tree | 5c2a5a21e8db2c725c2d8f042bff8d3a602591e3 /spec | |
parent | ef8eb3f6f7c1af167017ecc854e9fe385cee9354 (diff) |
Replace 'project/user_lookup.feature' spinach test with an rspec analog
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/commits/rss_spec.rb (renamed from spec/features/projects/commit/rss_spec.rb) | 0 | ||||
-rw-r--r-- | spec/features/projects/commits/user_browses_commits_spec.rb | 44 |
2 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/projects/commit/rss_spec.rb b/spec/features/projects/commits/rss_spec.rb index db958346f06..db958346f06 100644 --- a/spec/features/projects/commit/rss_spec.rb +++ b/spec/features/projects/commits/rss_spec.rb diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb new file mode 100644 index 00000000000..41f3c15a94c --- /dev/null +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'User broweses commits' do + let(:user) { create(:user) } + let(:project) { create(:project, :repository, namespace: user.namespace) } + + before do + project.add_master(user) + sign_in(user) + end + + context 'primary email' do + it 'finds a commit by a primary email' do + user = create(:user, email: 'dmitriy.zaporozhets@gmail.com') + + visit(project_commit_path(project, RepoHelpers.sample_commit.id)) + + check_author_link(RepoHelpers.sample_commit.author_email, user) + end + end + + context 'secondary email' do + it 'finds a commit by a secondary email' do + user = + create(:user) do |user| + create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) + end + + visit(project_commit_path(project, RepoHelpers.sample_commit.parent_id)) + + check_author_link(RepoHelpers.sample_commit.author_email, user) + end + end +end + +private + +def check_author_link(email, author) + author_link = find('.commit-author-link') + + expect(author_link['href']).to eq(user_path(author)) + expect(author_link['title']).to eq(email) + expect(find('.commit-author-name').text).to eq(author.name) +end |