From 4a1d7ea727f446f77db02ab29f6f8f76ff6ef58d Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu <heinrich@gitlab.com> Date: Sat, 27 Apr 2019 08:34:55 +0800 Subject: [PATCH] Upgrade to Capybara 3 Fix whitespace in specs because normalize_ws is slightly different from Capybara 2 behavior --- Gemfile | 2 +- Gemfile.lock | 17 +++++++++-------- ee/spec/features/groups/group_settings_spec.rb | 2 +- .../projects/environments_pod_logs_spec.rb | 2 +- ee/spec/features/projects/new_project_spec.rb | 2 +- .../services/prometheus_custom_metrics_spec.rb | 10 +++++++++- .../services/user_activates_github_spec.rb | 5 +++++ 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 +- .../user_accepts_merge_request_spec.rb | 3 +-- .../user_creates_image_diff_notes_spec.rb | 2 +- .../merge_request/user_sees_diff_spec.rb | 3 +-- .../user_sees_merge_widget_spec.rb | 4 ++-- .../user_suggests_changes_on_diff_spec.rb | 4 ++-- .../commits/user_browses_commits_spec.rb | 2 +- .../projects/features_visibility_spec.rb | 3 ++- .../projects/files/undo_template_spec.rb | 2 +- .../projects/files/user_creates_files_spec.rb | 1 - .../projects/labels/user_removes_labels_spec.rb | 2 +- .../projects/pipelines/pipeline_spec.rb | 2 +- .../settings/integration_settings_spec.rb | 2 +- spec/features/projects/tree/upload_file_spec.rb | 2 +- .../search/user_searches_for_commits_spec.rb | 2 +- spec/features/tags/master_creates_tag_spec.rb | 2 +- spec/support/capybara.rb | 2 ++ .../discussion_comments_shared_example.rb | 2 +- .../shrug_quick_action_shared_examples.rb | 2 +- .../tableflip_quick_action_shared_examples.rb | 2 +- .../pipeline_failed_email.html.haml_spec.rb | 4 ++-- .../pipeline_failed_email.text.erb_spec.rb | 2 +- .../pipeline_success_email.html.haml_spec.rb | 4 ++-- spec/views/profiles/show.html.haml_spec.rb | 4 ++-- 34 files changed, 62 insertions(+), 48 deletions(-) diff --git a/Gemfile b/Gemfile index 97734d20dd234..fd570a0d48ea2 100644 --- a/Gemfile +++ b/Gemfile @@ -362,7 +362,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 712b1fdc110b2..0adf49524b70d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,13 +118,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 @@ -689,7 +690,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) @@ -781,7 +782,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) @@ -1074,7 +1075,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/ee/spec/features/groups/group_settings_spec.rb b/ee/spec/features/groups/group_settings_spec.rb index d14c58598f8a9..1ea5c6ab2c4df 100644 --- a/ee/spec/features/groups/group_settings_spec.rb +++ b/ee/spec/features/groups/group_settings_spec.rb @@ -174,7 +174,7 @@ results = find_all('.select2-result') expect(results.count).to eq(1) - expect(results.last.text).to eq "#{nested_group.full_name} #{nested_group.full_path}" + expect(results.last.text).to eq "#{nested_group.full_name}\n#{nested_group.full_path}" end end end diff --git a/ee/spec/features/projects/environments_pod_logs_spec.rb b/ee/spec/features/projects/environments_pod_logs_spec.rb index dc07e2e6e0fd0..4b7a222091067 100644 --- a/ee/spec/features/projects/environments_pod_logs_spec.rb +++ b/ee/spec/features/projects/environments_pod_logs_spec.rb @@ -38,7 +38,7 @@ expect(item.text).to eq(pod_names[i]) end end - expect(page).to have_content("Log 1\nLog 2\nLog 3") + expect(page).to have_content("Log 1 Log 2 Log 3") end end diff --git a/ee/spec/features/projects/new_project_spec.rb b/ee/spec/features/projects/new_project_spec.rb index 9c956dd0f9d9b..a3d6131b0b1c4 100644 --- a/ee/spec/features/projects/new_project_spec.rb +++ b/ee/spec/features/projects/new_project_spec.rb @@ -216,7 +216,7 @@ def visit_create_from_group_template_tab it 'the tab shows the list of templates available' do page.within('#custom-group-project-templates') do # Show templates in case they're collapsed - page.all(:xpath, "//div[@class='js-template-group-options template-group-options']").each(&:click) + page.all(:xpath, "//div[@class='js-template-group-options template-group-options']", wait: false).each(&:click) expect(page).to have_selector('.template-option', count: template_number) end diff --git a/ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb b/ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb index 1ea4ba2537deb..97ac2e8b8cc23 100644 --- a/ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb +++ b/ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb @@ -1,10 +1,16 @@ require 'spec_helper' describe 'Prometheus custom metrics', :js do + include PrometheusHelpers + let(:project) { create(:project) } let(:user) { create(:user) } let!(:prometheus_metric) { create(:prometheus_metric, project: project) } + around do |example| + Timecop.freeze { example.run } + end + before do project.add_maintainer(user) sign_in(user) @@ -15,6 +21,8 @@ click_link('Prometheus') + stub_request(:get, prometheus_query_with_time_url('avg(metric)', Time.now.utc)) + fill_in_prometheus_integration click_link('Prometheus') @@ -22,7 +30,7 @@ def fill_in_prometheus_integration check('Active') - fill_in('API URL', with: 'http://prometheus.example.com') + fill_in('API URL', with: 'https://prometheus.example.com') click_button('Save changes') end diff --git a/ee/spec/features/projects/services/user_activates_github_spec.rb b/ee/spec/features/projects/services/user_activates_github_spec.rb index 40c58a63efc1d..f35a23d12db0b 100644 --- a/ee/spec/features/projects/services/user_activates_github_spec.rb +++ b/ee/spec/features/projects/services/user_activates_github_spec.rb @@ -50,6 +50,11 @@ def fill_in_details let(:project) { create(:project, ci_pipelines: [pipeline])} it 'tests service before save' do + stub_request(:post, "https://api.github.com/repos/h5bp/html5-boilerplate/statuses/#{pipeline.sha}").to_return( + body: { context: {} }.to_json, + headers: { 'Content-Type' => 'application/json' } + ) + click_button 'Test settings and save changes' wait_for_requests diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 2adeb37c98a07..e6f44aa7d204d 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -82,7 +82,7 @@ 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 @@ 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 @@ 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 debae0ea930ab..b74bbf848acde 100644 --- a/spec/features/ics/dashboard_issues_spec.rb +++ b/spec/features/ics/dashboard_issues_spec.rb @@ -91,7 +91,7 @@ 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 4177c7f8704c1..86da720c8be87 100644 --- a/spec/features/ics/group_issues_spec.rb +++ b/spec/features/ics/group_issues_spec.rb @@ -66,7 +66,7 @@ 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 0d9844be09990..37b90c666bc1a 100644 --- a/spec/features/ics/project_issues_spec.rb +++ b/spec/features/ics/project_issues_spec.rb @@ -65,7 +65,7 @@ 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 5fa23dbb99844..3d029ccec1aaa 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 @@ 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 5db54f42264c2..3a9a06a6bc302 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 @@ def drag_and_drop_by(element, right_by, down_by) 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 04b075259194b..8dc5912b8be26 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 @@ 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 0066e985fbb09..393077a916f34 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 @@ def compared_data 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 @@ def compared_data 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 04c7f4b6c768b..780de76d2c5ad 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 @@ 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 953517cdff91a..a84fee34669ac 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 @@ 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 ab16fdee88350..254e885ce4622 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -68,7 +68,8 @@ 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 fa785ed10effb..9161814539167 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -50,7 +50,7 @@ def check_undo_button_display 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 69f8bd4d31972..264b288ab38fb 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 @@ def submit_new_file(options) 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 c231e54decd0a..7f49ddf560f89 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 @@ 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 1de153db41c3c..77f0f237d0a61 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -91,7 +91,7 @@ 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 32959969f54fd..016ccf63f5884 100644 --- a/spec/features/projects/settings/integration_settings_spec.rb +++ b/spec/features/projects/settings/integration_settings_spec.rb @@ -41,7 +41,7 @@ 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 dcf7d314f8ed4..e5dd2f40fdf49 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -29,6 +29,6 @@ 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 28cae444588ef..998f852138437 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 @@ 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 db2970f33401e..f80ddd050d78b 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -39,7 +39,7 @@ 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 14ce3c32e779e..56ac208a025ed 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -53,9 +53,11 @@ ) 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 542f533d59046..0f8af2c5d6df4 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -84,7 +84,7 @@ # # 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 0a5268085853f..b592cf16f6710 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 @@ 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 ef831e39872e8..c174127c4ffbd 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 @@ 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 d9d73f789c5c1..d04affc7df1e3 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 @@ 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 @@ 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 a7d3dc09fd47f..079fb865d7b66 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 @@ 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 a793b37e41223..8ee7f954d701d 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 @@ 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 @@ 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 e89a8cb962659..9e7ac0b84fa67 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -12,8 +12,8 @@ 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 -- GitLab