From 96ed5a8bd78f90b0c7a8b044c4bd99e3af46dd71 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Fri, 26 Apr 2019 23:51:05 +0800 Subject: Upgrade to Capybara 3 Fix whitespace in specs because normalize_ws is slightly different from Capybara 2 behavior --- Gemfile | 2 +- Gemfile.lock | 17 +++++++++-------- spec/features/commits_spec.rb | 6 +++--- spec/features/ics/dashboard_issues_spec.rb | 2 +- spec/features/ics/group_issues_spec.rb | 2 +- spec/features/ics/project_issues_spec.rb | 2 +- .../merge_request/user_accepts_merge_request_spec.rb | 3 +-- .../merge_request/user_creates_image_diff_notes_spec.rb | 2 +- spec/features/merge_request/user_sees_diff_spec.rb | 3 +-- .../merge_request/user_sees_merge_widget_spec.rb | 4 ++-- .../merge_request/user_suggests_changes_on_diff_spec.rb | 4 ++-- .../projects/commits/user_browses_commits_spec.rb | 2 +- spec/features/projects/features_visibility_spec.rb | 3 ++- spec/features/projects/files/undo_template_spec.rb | 2 +- spec/features/projects/files/user_creates_files_spec.rb | 1 - .../projects/labels/user_removes_labels_spec.rb | 2 +- spec/features/projects/pipelines/pipeline_spec.rb | 2 +- .../projects/settings/integration_settings_spec.rb | 2 +- spec/features/projects/tree/upload_file_spec.rb | 2 +- spec/features/search/user_searches_for_commits_spec.rb | 2 +- spec/features/tags/master_creates_tag_spec.rb | 2 +- spec/support/capybara.rb | 2 ++ .../features/discussion_comments_shared_example.rb | 2 +- .../issuable/shrug_quick_action_shared_examples.rb | 2 +- .../issuable/tableflip_quick_action_shared_examples.rb | 2 +- .../notify/pipeline_failed_email.html.haml_spec.rb | 4 ++-- .../views/notify/pipeline_failed_email.text.erb_spec.rb | 2 +- .../notify/pipeline_success_email.html.haml_spec.rb | 4 ++-- spec/views/profiles/show.html.haml_spec.rb | 4 ++-- 29 files changed, 45 insertions(+), 44 deletions(-) diff --git a/Gemfile b/Gemfile index c22a3191c3c..0569e0649dc 100644 --- a/Gemfile +++ b/Gemfile @@ -347,7 +347,7 @@ group :development, :test do # Generate Fake data gem 'ffaker', '~> 2.10' - gem 'capybara', '~> 2.18.0' + gem 'capybara', '~> 3.22.0' gem 'capybara-screenshot', '~> 1.0.22' gem 'selenium-webdriver', '~> 3.141' diff --git a/Gemfile.lock b/Gemfile.lock index 785a77bc202..1f6c8d05992 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -110,13 +110,14 @@ GEM bundler (~> 1.2) thor (~> 0.18) byebug (9.1.0) - capybara (2.18.0) + capybara (3.22.0) addressable mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) capybara-screenshot (1.0.22) capybara (>= 1.0, < 4) launchy @@ -658,7 +659,7 @@ GEM pry (~> 0.10) pry-rails (0.3.6) pry (>= 0.10.4) - public_suffix (3.0.3) + public_suffix (3.1.0) puma (3.12.0) puma_worker_killer (0.1.0) get_process_mem (~> 0.2) @@ -750,7 +751,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.6.0) redis (>= 2.2, < 5) - regexp_parser (1.4.0) + regexp_parser (1.5.1) regexp_property_values (0.3.4) representable (3.0.4) declarative (< 0.1.0) @@ -1040,7 +1041,7 @@ DEPENDENCIES browser (~> 2.5) bullet (~> 5.5.0) bundler-audit (~> 0.5.0) - capybara (~> 2.18.0) + capybara (~> 3.22.0) capybara-screenshot (~> 1.0.22) carrierwave (~> 1.3) charlock_holmes (~> 0.7.5) diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 2adeb37c98a..e6f44aa7d20 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -82,7 +82,7 @@ describe 'Commits' do it 'shows pipeline`s data' do expect(page).to have_content pipeline.sha[0..7] - expect(page).to have_content pipeline.git_commit_message + expect(page).to have_content pipeline.git_commit_message.gsub!(/\s+/, ' ') expect(page).to have_content pipeline.user.name end end @@ -125,7 +125,7 @@ describe 'Commits' do it 'Renders header', :js do expect(page).to have_content pipeline.sha[0..7] - expect(page).to have_content pipeline.git_commit_message + expect(page).to have_content pipeline.git_commit_message.gsub!(/\s+/, ' ') expect(page).to have_content pipeline.user.name expect(page).not_to have_link('Cancel running') expect(page).not_to have_link('Retry') @@ -147,7 +147,7 @@ describe 'Commits' do it do expect(page).to have_content pipeline.sha[0..7] - expect(page).to have_content pipeline.git_commit_message + expect(page).to have_content pipeline.git_commit_message.gsub!(/\s+/, ' ') expect(page).to have_content pipeline.user.name expect(page).not_to have_link('Cancel running') diff --git a/spec/features/ics/dashboard_issues_spec.rb b/spec/features/ics/dashboard_issues_spec.rb index debae0ea930..b74bbf848ac 100644 --- a/spec/features/ics/dashboard_issues_spec.rb +++ b/spec/features/ics/dashboard_issues_spec.rb @@ -91,7 +91,7 @@ describe 'Dashboard Issues Calendar Feed' do expect(body).to have_text("SUMMARY:test title (in #{project.full_path})") # line length for ics is 75 chars - expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, "\r\n") + expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, ' ') expect(body).to have_text(expected_description) expect(body).to have_text("DTSTART;VALUE=DATE:#{Date.tomorrow.strftime('%Y%m%d')}") expect(body).to have_text("URL:#{issue_url(issue)}") diff --git a/spec/features/ics/group_issues_spec.rb b/spec/features/ics/group_issues_spec.rb index 4177c7f8704..86da720c8be 100644 --- a/spec/features/ics/group_issues_spec.rb +++ b/spec/features/ics/group_issues_spec.rb @@ -66,7 +66,7 @@ describe 'Group Issues Calendar Feed' do expect(body).to have_text("SUMMARY:test title (in #{project.full_path})") # line length for ics is 75 chars - expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, "\r\n") + expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, ' ') expect(body).to have_text(expected_description) expect(body).to have_text("DTSTART;VALUE=DATE:#{Date.tomorrow.strftime('%Y%m%d')}") expect(body).to have_text("URL:#{issue_url(issue)}") diff --git a/spec/features/ics/project_issues_spec.rb b/spec/features/ics/project_issues_spec.rb index 0d9844be099..37b90c666bc 100644 --- a/spec/features/ics/project_issues_spec.rb +++ b/spec/features/ics/project_issues_spec.rb @@ -65,7 +65,7 @@ describe 'Project Issues Calendar Feed' do expect(body).to have_text("SUMMARY:test title (in #{project.full_path})") # line length for ics is 75 chars - expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, "\r\n") + expected_description = "DESCRIPTION:Find out more at #{issue_url(issue)}".insert(75, ' ') expect(body).to have_text(expected_description) expect(body).to have_text("DTSTART;VALUE=DATE:#{Date.tomorrow.strftime('%Y%m%d')}") expect(body).to have_text("URL:#{issue_url(issue)}") diff --git a/spec/features/merge_request/user_accepts_merge_request_spec.rb b/spec/features/merge_request/user_accepts_merge_request_spec.rb index 5fa23dbb998..3d029ccec1a 100644 --- a/spec/features/merge_request/user_accepts_merge_request_spec.rb +++ b/spec/features/merge_request/user_accepts_merge_request_spec.rb @@ -15,8 +15,7 @@ describe 'User accepts a merge request', :js do click_button('Merge') - expect(page).to have_content("The changes were merged into #{merge_request.target_branch} with \ - #{merge_request.short_merge_commit_sha}") + expect(page).to have_content("The changes were merged into #{merge_request.target_branch} with #{merge_request.short_merge_commit_sha}") end context 'with removing the source branch' do diff --git a/spec/features/merge_request/user_creates_image_diff_notes_spec.rb b/spec/features/merge_request/user_creates_image_diff_notes_spec.rb index 5db54f42264..3a9a06a6bc3 100644 --- a/spec/features/merge_request/user_creates_image_diff_notes_spec.rb +++ b/spec/features/merge_request/user_creates_image_diff_notes_spec.rb @@ -313,7 +313,7 @@ describe 'Merge request > User creates image diff notes', :js do def create_image_diff_note expand_text = 'Click to expand it.' - page.all('a', text: expand_text).each do |element| + page.all('a', text: expand_text, wait: false).each do |element| element.click end diff --git a/spec/features/merge_request/user_sees_diff_spec.rb b/spec/features/merge_request/user_sees_diff_spec.rb index 04b07525919..8dc5912b8be 100644 --- a/spec/features/merge_request/user_sees_diff_spec.rb +++ b/spec/features/merge_request/user_sees_diff_spec.rb @@ -43,8 +43,7 @@ describe 'Merge request > User sees diff', :js do visit diffs_project_merge_request_path(project, merge_request) page.within('.alert') do - expect(page).to have_text("Too many changes to show. Plain diff Email patch To preserve - performance only 3 of 3+ files are displayed.") + expect(page).to have_text("Too many changes to show. Plain diff Email patch To preserve performance only 3 of 3+ files are displayed.") end end end diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 0066e985fbb..393077a916f 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -565,7 +565,7 @@ describe 'Merge request > User sees merge widget', :js do click_button 'subtractTest' expect(page).to have_content('6.66') - expect(page).to have_content(sample_java_failed_message) + expect(page).to have_content(sample_java_failed_message.gsub!(/\s+/, ' ').strip) end end end @@ -610,7 +610,7 @@ describe 'Merge request > User sees merge widget', :js do click_button 'Test#sum when a is 2 and b is 2 returns summary' expect(page).to have_content('2.22') - expect(page).to have_content(sample_rspec_failed_message) + expect(page).to have_content(sample_rspec_failed_message.gsub!(/\s+/, ' ').strip) end end end diff --git a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb index 04c7f4b6c76..780de76d2c5 100644 --- a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb +++ b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb @@ -7,8 +7,8 @@ describe 'User comments on a diff', :js do include RepoHelpers def expect_suggestion_has_content(element, expected_changing_content, expected_suggested_content) - changing_content = element.all(:css, '.line_holder.old').map(&:text) - suggested_content = element.all(:css, '.line_holder.new').map(&:text) + changing_content = element.all(:css, '.line_holder.old').map { |el| el.text(normalize_ws: true) } + suggested_content = element.all(:css, '.line_holder.new').map { |el| el.text(normalize_ws: true) } expect(changing_content).to eq(expected_changing_content) expect(suggested_content).to eq(expected_suggested_content) diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index 953517cdff9..a84fee34669 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -13,7 +13,7 @@ describe 'User browses commits' do it 'renders commit' do visit project_commit_path(project, sample_commit.id) - expect(page).to have_content(sample_commit.message) + expect(page).to have_content(sample_commit.message.gsub!(/\s+/, ' ')) .and have_content("Showing #{sample_commit.files_changed_count} changed files") .and have_content('Side-by-side') end diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index ab16fdee883..254e885ce46 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -68,7 +68,8 @@ describe 'Edit Project Settings' do end it "hides builds when disabled" do - allow(Ability).to receive(:allowed?).with(member, :read_builds, project).and_return(false) + allow(Ability).to receive(:allowed?).and_return(true) + allow(Ability).to receive(:allowed?).with(member, :read_build, project).and_return(false) visit project_pipelines_path(project) diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index fa785ed10ef..91618145391 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -50,7 +50,7 @@ end def check_content_reverted(template_content) find('.template-selectors-undo-menu .btn-info').click expect(page).not_to have_content(template_content) - expect(find('.template-type-selector .dropdown-toggle-text')).to have_content + expect(page).to have_css('.template-type-selector .dropdown-toggle-text') end def select_file_template(template_selector_selector, template_name) diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index 69f8bd4d319..264b288ab38 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -174,7 +174,6 @@ describe 'Projects > Files > User creates files' do it 'creates and commit new file in forked project', :js do expect(page).to have_selector('.file-editor') - expect(page).to have_content find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") diff --git a/spec/features/projects/labels/user_removes_labels_spec.rb b/spec/features/projects/labels/user_removes_labels_spec.rb index c231e54decd..7f49ddf560f 100644 --- a/spec/features/projects/labels/user_removes_labels_spec.rb +++ b/spec/features/projects/labels/user_removes_labels_spec.rb @@ -41,7 +41,7 @@ describe "User removes labels" do it "removes all labels" do loop do - li = page.first(".label-list-item") + li = page.first(".label-list-item", minimum: 0) break unless li li.find('.js-label-options-dropdown').click diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 1de153db41c..77f0f237d0a 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -91,7 +91,7 @@ describe 'Pipeline', :js do within '.pipeline-info' do expect(page).to have_content("#{pipeline.statuses.count} jobs " \ - "for #{pipeline.ref} ") + "for #{pipeline.ref}") expect(page).to have_link(pipeline.ref, href: project_commits_path(pipeline.project, pipeline.ref)) end diff --git a/spec/features/projects/settings/integration_settings_spec.rb b/spec/features/projects/settings/integration_settings_spec.rb index 32959969f54..016ccf63f58 100644 --- a/spec/features/projects/settings/integration_settings_spec.rb +++ b/spec/features/projects/settings/integration_settings_spec.rb @@ -41,7 +41,7 @@ describe 'Projects > Settings > Integration settings' do expect(page).to have_content('Issues events') expect(page).to have_content('Confidential issues events') expect(page).to have_content('Note events') - expect(page).to have_content('Merge requests events') + expect(page).to have_content('Merge requests events') expect(page).to have_content('Pipeline events') expect(page).to have_content('Wiki page events') end diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index dcf7d314f8e..e5dd2f40fdf 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -29,6 +29,6 @@ describe 'Multi-file editor upload file', :js do attach_file('file-upload', txt_file) expect(page).to have_selector('.multi-file-tab', text: 'doc_sample.txt') - expect(find('.blob-editor-container .lines-content')['innerText']).to have_content(File.open(txt_file, &:readline)) + expect(find('.blob-editor-container .lines-content')['innerText']).to have_content(File.open(txt_file, &:readline).gsub!(/\s+/, ' ')) end end diff --git a/spec/features/search/user_searches_for_commits_spec.rb b/spec/features/search/user_searches_for_commits_spec.rb index 28cae444588..998f8521384 100644 --- a/spec/features/search/user_searches_for_commits_spec.rb +++ b/spec/features/search/user_searches_for_commits_spec.rb @@ -35,7 +35,7 @@ describe 'User searches for commits' do fill_in('search', with: 'deadbeef') click_button('Search') - expect(page).to have_current_path('/search', only_path: true) + expect(page).to have_current_path('/search', ignore_query: true) end it 'finds multiple commits' do diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index db2970f3340..f80ddd050d7 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -39,7 +39,7 @@ describe 'Maintainer creates tag' do project_tag_path(project, 'v3.0')) expect(page).to have_content 'v3.0' page.within 'pre.wrap' do - expect(page).to have_content "Awesome tag message\n\n- hello\n- world" + expect(page).to have_content "Awesome tag message - hello - world" end end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 14ce3c32e77..56ac208a025 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -53,9 +53,11 @@ Capybara.register_driver :chrome do |app| ) end +Capybara.server = :webrick Capybara.javascript_driver = :chrome Capybara.default_max_wait_time = timeout Capybara.ignore_hidden_elements = true +Capybara.default_normalize_ws = true # Keep only the screenshots generated from the last failing test suite Capybara::Screenshot.prune_strategy = :keep_last_run diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb index 542f533d590..0f8af2c5d6d 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -84,7 +84,7 @@ shared_examples 'discussion comments' do |resource_name| # # if dropdown menu is not toggled (and also not present), # it's "issue-type" dropdown - if first(menu_selector).nil? + if first(menu_selector, minimum: 0).nil? expect(find(dropdown_selector)).to have_content 'Comment' find(toggle_selector).click diff --git a/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb index 0a526808585..b592cf16f67 100644 --- a/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb @@ -27,7 +27,7 @@ shared_examples 'shrug quick action' do |issuable_type| expect(issuable.description).to eq "bug description\noops ¯\\_(ツ)_/¯" expect(page).to have_content 'bug 345' - expect(page).to have_content "bug description\noops ¯\\_(ツ)_/¯" + expect(page).to have_content "bug description oops ¯\\_(ツ)_/¯" end end diff --git a/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb index ef831e39872..c174127c4ff 100644 --- a/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb @@ -27,7 +27,7 @@ shared_examples 'tableflip quick action' do |issuable_type| expect(issuable.description).to eq "bug description\noops (╯°□°)╯︵ ┻━┻" expect(page).to have_content 'bug 345' - expect(page).to have_content "bug description\noops (╯°□°)╯︵ ┻━┻" + expect(page).to have_content "bug description oops (╯°□°)╯︵ ┻━┻" end end diff --git a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb index d9d73f789c5..d04affc7df1 100644 --- a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb @@ -28,7 +28,7 @@ describe 'notify/pipeline_failed_email.html.haml' do expect(rendered).to have_content "Your pipeline has failed" expect(rendered).to have_content pipeline.project.name - expect(rendered).to have_content pipeline.git_commit_message.truncate(50) + expect(rendered).to have_content pipeline.git_commit_message.truncate(50).gsub!(/\s+/, ' ') expect(rendered).to have_content pipeline.commit.author_name expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content pipeline.user.name @@ -45,7 +45,7 @@ describe 'notify/pipeline_failed_email.html.haml' do expect(rendered).to have_content "Your pipeline has failed" expect(rendered).to have_content pipeline.project.name - expect(rendered).to have_content pipeline.git_commit_message.truncate(50) + expect(rendered).to have_content pipeline.git_commit_message.truncate(50).gsub!(/\s+/, ' ') expect(rendered).to have_content pipeline.commit.author_name expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content "by API" diff --git a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb index a7d3dc09fd4..079fb865d7b 100644 --- a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb +++ b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb @@ -30,7 +30,7 @@ describe 'notify/pipeline_failed_email.text.erb' do expect(rendered).to have_content('Your pipeline has failed') expect(rendered).to have_content(pipeline.project.name) - expect(rendered).to have_content(pipeline.git_commit_message.truncate(50)) + expect(rendered).to have_content(pipeline.git_commit_message.truncate(50).gsub!(/\s+/, ' ')) expect(rendered).to have_content(pipeline.commit.author_name) expect(rendered).to have_content("##{pipeline.id}") expect(rendered).to have_content(pipeline.user.name) diff --git a/spec/views/notify/pipeline_success_email.html.haml_spec.rb b/spec/views/notify/pipeline_success_email.html.haml_spec.rb index a793b37e412..8ee7f954d70 100644 --- a/spec/views/notify/pipeline_success_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_success_email.html.haml_spec.rb @@ -28,7 +28,7 @@ describe 'notify/pipeline_success_email.html.haml' do expect(rendered).to have_content "Your pipeline has passed" expect(rendered).to have_content pipeline.project.name - expect(rendered).to have_content pipeline.git_commit_message.truncate(50) + expect(rendered).to have_content pipeline.git_commit_message.truncate(50).gsub!(/\s+/, ' ') expect(rendered).to have_content pipeline.commit.author_name expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content pipeline.user.name @@ -45,7 +45,7 @@ describe 'notify/pipeline_success_email.html.haml' do expect(rendered).to have_content "Your pipeline has passed" expect(rendered).to have_content pipeline.project.name - expect(rendered).to have_content pipeline.git_commit_message.truncate(50) + expect(rendered).to have_content pipeline.git_commit_message.truncate(50).gsub!(/\s+/, ' ') expect(rendered).to have_content pipeline.commit.author_name expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content "by API" diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb index e89a8cb9626..9e7ac0b84fa 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -12,8 +12,8 @@ describe 'profiles/show' do it 'displays the correct elements' do render - expect(rendered).to have_field('user_name', user.name) - expect(rendered).to have_field('user_id', user.id) + expect(rendered).to have_field('user_name', with: user.name) + expect(rendered).to have_field('user_id', with: user.id) end end end -- cgit v1.2.1