diff --git a/lib/rubocop/cop/capybara/current_path_expectation.rb b/lib/rubocop/cop/capybara/current_path_expectation.rb index 41c7d82e..6f23ac7a 100644 --- a/lib/rubocop/cop/capybara/current_path_expectation.rb +++ b/lib/rubocop/cop/capybara/current_path_expectation.rb @@ -37,20 +37,20 @@ class CurrentPathExpectation < ::RuboCop::Cop::Base RESTRICT_ON_SEND = %i[expect].freeze # @!method expectation_set_on_current_path(node) - def_node_matcher :expectation_set_on_current_path, <<-PATTERN + def_node_matcher :expectation_set_on_current_path, <<~PATTERN (send nil? :expect (send {(send nil? :page) nil?} :current_path)) PATTERN # Supported matchers: eq(...) / match(/regexp/) / match('regexp') # @!method as_is_matcher(node) - def_node_matcher :as_is_matcher, <<-PATTERN + def_node_matcher :as_is_matcher, <<~PATTERN (send #expectation_set_on_current_path ${:to :to_not :not_to} ${(send nil? :eq ...) (send nil? :match (regexp ...))}) PATTERN # @!method regexp_node_matcher(node) - def_node_matcher :regexp_node_matcher, <<-PATTERN + def_node_matcher :regexp_node_matcher, <<~PATTERN (send #expectation_set_on_current_path ${:to :to_not :not_to} $(send nil? :match ${str dstr xstr})) diff --git a/lib/rubocop/cop/capybara/specific_actions.rb b/lib/rubocop/cop/capybara/specific_actions.rb index 01afbe6b..7fba57d2 100644 --- a/lib/rubocop/cop/capybara/specific_actions.rb +++ b/lib/rubocop/cop/capybara/specific_actions.rb @@ -28,7 +28,7 @@ class SpecificActions < ::RuboCop::Cop::Base }.freeze # @!method click_on_selector(node) - def_node_matcher :click_on_selector, <<-PATTERN + def_node_matcher :click_on_selector, <<~PATTERN (send _ :find (str $_) ...) PATTERN diff --git a/lib/rubocop/cop/capybara/specific_matcher.rb b/lib/rubocop/cop/capybara/specific_matcher.rb index 6522a398..d8e9fc51 100644 --- a/lib/rubocop/cop/capybara/specific_matcher.rb +++ b/lib/rubocop/cop/capybara/specific_matcher.rb @@ -38,12 +38,12 @@ class SpecificMatcher < ::RuboCop::Cop::Base }.freeze # @!method first_argument(node) - def_node_matcher :first_argument, <<-PATTERN + def_node_matcher :first_argument, <<~PATTERN (send nil? _ (str $_) ... ) PATTERN # @!method text_with_regexp?(node) - def_node_search :text_with_regexp?, <<-PATTERN + def_node_search :text_with_regexp?, <<~PATTERN (pair (sym {:text :exact_text}) (regexp ...)) PATTERN diff --git a/rubocop-capybara.gemspec b/rubocop-capybara.gemspec index f8cf7da0..21f5a52d 100644 --- a/rubocop-capybara.gemspec +++ b/rubocop-capybara.gemspec @@ -6,7 +6,7 @@ require 'rubocop/capybara/version' Gem::Specification.new do |spec| spec.name = 'rubocop-capybara' spec.summary = 'Code style checking for Capybara test files' - spec.description = <<-DESCRIPTION + spec.description = <<~DESCRIPTION Code style checking for Capybara test files (RSpec, Cucumber, Minitest). A plugin for the RuboCop code style enforcing & linting tool. DESCRIPTION diff --git a/spec/rubocop/capybara/description_extractor_spec.rb b/spec/rubocop/capybara/description_extractor_spec.rb index ea24335f..9fad89a0 100644 --- a/spec/rubocop/capybara/description_extractor_spec.rb +++ b/spec/rubocop/capybara/description_extractor_spec.rb @@ -6,7 +6,7 @@ RSpec.describe RuboCop::Capybara::DescriptionExtractor do let(:yardocs) do - YARD.parse_string(<<-RUBY) + YARD.parse_string(<<~RUBY) # This is not a cop class RuboCop::Cop::Mixin::Sneaky end diff --git a/spec/rubocop/cop/capybara/current_path_expectation_spec.rb b/spec/rubocop/cop/capybara/current_path_expectation_spec.rb index fec5db52..8d61ea7f 100644 --- a/spec/rubocop/cop/capybara/current_path_expectation_spec.rb +++ b/spec/rubocop/cop/capybara/current_path_expectation_spec.rb @@ -38,12 +38,12 @@ end it 'flags offenses for `expect(page.current_path)`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page.current_path).to eq("/callback") ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - instead, use the `have_current_path` matcher on `page` RUBY - expect_correction(<<-RUBY) + expect_correction(<<~RUBY) expect(page).to have_current_path("/callback", ignore_query: true) RUBY end @@ -208,19 +208,19 @@ end it "doesn't flag an offense for other expectations" do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(current_user).to eq(user) RUBY end it "doesn't flag an offense for other references to `current_path`" do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) current_path = WalkingRoute.last.path RUBY end it 'ignores `match` with a variable, but does not autocorrect' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page.current_path).to match(variable) ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - instead, use the `have_current_path` matcher on `page` RUBY diff --git a/spec/rubocop/cop/capybara/specific_actions_spec.rb b/spec/rubocop/cop/capybara/specific_actions_spec.rb index 1a9e7a9d..8deb7723 100644 --- a/spec/rubocop/cop/capybara/specific_actions_spec.rb +++ b/spec/rubocop/cop/capybara/specific_actions_spec.rb @@ -60,7 +60,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is multiple selector `,`' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button,a').click find('a, button').click RUBY @@ -68,7 +68,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is multiple selector `>`' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button>a').click find('a > button').click RUBY @@ -76,7 +76,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is multiple selector `+`' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button+a').click find('a + button').click RUBY @@ -84,7 +84,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is multiple selector `~`' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button~a').click find('a ~ button').click RUBY @@ -94,7 +94,7 @@ it 'registers an offense for abstract action when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `click_button`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) find("button[#{attr}=foo]").click ^^^^^^^^^^^^^^{attr}^^^^^^^^^^^^^ Prefer `click_button` over `find('button').click`. RUBY @@ -105,7 +105,7 @@ it 'does not register an offense for abstract action when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `click_link` without `href`' do - expect_no_offenses(<<-RUBY, attr: attr) + expect_no_offenses(<<~RUBY, attr: attr) find("a[#{attr}=foo]").click find("a[#{attr}]").click RUBY @@ -114,7 +114,7 @@ it 'registers an offense for abstract action when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `click_link` with attribute `href`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) find("a[#{attr}=foo][href='http://example.com']").click ^^^^^^^^^{attr}^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_link` over `find('a').click`. RUBY @@ -123,7 +123,7 @@ it 'registers an offense for abstract action when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `click_link` with option `href`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) find("a[#{attr}=foo]", href: 'http://example.com').click ^^^^^^^^^{attr}^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_link` over `find('a').click`. find("a[#{attr}=foo]", text: 'foo', href: 'http://example.com').click @@ -134,14 +134,14 @@ it 'registers an offense when using abstract action with ' \ 'first argument is element with multiple replaceable attributes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) find('button[disabled=true][name="foo"]', exact_text: 'foo').click ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_button` over `find('button').click`. RUBY end it 'registers an offense when using abstract action with state' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) find('button[disabled=false]', exact_text: 'foo').click ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_button` over `find('button').click`. RUBY @@ -149,7 +149,7 @@ it 'registers an offense when using abstract action with ' \ 'first argument is element with replaceable pseudo-classes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) find('button:not([disabled=true])', exact_text: 'bar').click ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_button` over `find('button').click`. RUBY @@ -157,7 +157,7 @@ it 'registers an offense when using abstract action with ' \ 'first argument is element with multiple replaceable pseudo-classes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) find('button:not([disabled=true]):enabled').click ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `click_button` over `find('button').click`. find('button:not([disabled=false]):disabled').click @@ -167,7 +167,7 @@ it 'does not register an offense when using abstract action with' \ 'first argument is element with not replaceable attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button[disabled]').click find('button[id=some-id][disabled]').click find('button[visible]').click @@ -177,21 +177,21 @@ it 'does not register an offense when using abstract action with ' \ 'first argument is element with replaceable pseudo-classes' \ 'and not boolean attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button:not([name="foo"][disabled=true])').click RUBY end it 'does not register an offense when using abstract action with ' \ 'first argument is element with multiple nonreplaceable pseudo-classes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button:first-of-type:not([disabled=true])').click RUBY end it 'does not register an offense for abstract action when ' \ 'first argument is element with nonreplaceable attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button[data-disabled=true]').click find('button[foo=bar]').click find('button[foo-bar=baz]', exact_text: 'foo').click @@ -200,7 +200,7 @@ it 'does not register an offense for abstract action when ' \ 'first argument is element with multiple nonreplaceable attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('button[disabled=true][foo=bar]').click find('button[foo=bar][disabled=true]').click find('button[foo=bar][disabled=true][bar=baz]').click @@ -211,7 +211,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is not a replaceable element' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('article').click find('body').click RUBY @@ -219,7 +219,7 @@ it 'does not register an offense for find and click actions when ' \ 'first argument is not an element' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) find('.a').click find('#button').click find('[a]').click diff --git a/spec/rubocop/cop/capybara/specific_matcher_spec.rb b/spec/rubocop/cop/capybara/specific_matcher_spec.rb index 953e415d..77061a3d 100644 --- a/spec/rubocop/cop/capybara/specific_matcher_spec.rb +++ b/spec/rubocop/cop/capybara/specific_matcher_spec.rb @@ -3,7 +3,7 @@ RSpec.describe RuboCop::Cop::Capybara::SpecificMatcher do it 'does not register an offense for abstract matcher when ' \ 'first argument is not a replaceable element' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_selector('article') expect(page).to have_no_selector('body') expect(page).to have_css('tbody') @@ -12,7 +12,7 @@ it 'does not register an offense for abstract matcher when ' \ 'first argument is not an element' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_no_css('.a') expect(page).to have_selector('#button') expect(page).to have_no_selector('[table]') @@ -20,7 +20,7 @@ end it 'registers an offense when using `have_selector`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_selector('button') ^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_selector`. expect(page).to have_selector('table') @@ -33,35 +33,35 @@ end it 'registers an offense when using `have_no_selector`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_no_selector('button') ^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_no_button` over `have_no_selector`. RUBY end it 'registers an offense when using `have_css`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button') ^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY end it 'registers an offense when using `have_no_css`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_no_css('button') ^^^^^^^^^^^^^^^^^^^^^ Prefer `have_no_button` over `have_no_css`. RUBY end it 'registers an offense when using abstract matcher and other args' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button', exact_text: 'foo') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY end it 'registers an offense when using abstract matcher with class selector' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button.cls') ^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. expect(page).to have_css('button.cls', text: 'foo') @@ -70,7 +70,7 @@ end it 'registers an offense when using abstract matcher with id selector' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button#id') ^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. expect(page).to have_css('button#id', text: 'foo') @@ -82,7 +82,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_button`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("button[#{attr}=foo]") ^^^^^^^^^^^^^^^^^^{attr}^^^^^^^ Prefer `have_button` over `have_css`. RUBY @@ -93,7 +93,7 @@ it 'does not register an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_link` without `href`' do - expect_no_offenses(<<-RUBY, attr: attr) + expect_no_offenses(<<~RUBY, attr: attr) expect(page).to have_css("a") expect(page).to have_css("a[#{attr}=foo]") expect(page).to have_css("a[#{attr}]") @@ -103,7 +103,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_link` with attribute `href`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("a[#{attr}=foo][href='http://example.com']") ^^^^^^^^^^^^^{attr}^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_link` over `have_css`. RUBY @@ -112,7 +112,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_link` with option `href`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("a[#{attr}=foo]", href: 'http://example.com') ^^^^^^^^^^^^^{attr}^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_link` over `have_css`. expect(page).to have_css("a[#{attr}=foo]", text: 'foo', href: 'http://example.com') @@ -124,7 +124,7 @@ it 'registers an offense for abstract matcher when ' \ 'first argument is element with replaceable attributes href ' \ 'for `have_link`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css("a[href='http://example.com']") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_link` over `have_css`. RUBY @@ -134,7 +134,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_table`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("table[#{attr}=foo]") ^^^^^^^^^^^^^^^^^{attr}^^^^^^^ Prefer `have_table` over `have_css`. RUBY @@ -145,7 +145,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_select`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("select[#{attr}=foo]") ^^^^^^^^^^^^^^^^^^{attr}^^^^^^^ Prefer `have_select` over `have_css`. RUBY @@ -156,7 +156,7 @@ it 'registers an offense for abstract matcher when ' \ "first argument is element with replaceable attributes #{attr} " \ 'for `have_field`' do - expect_offense(<<-RUBY, attr: attr) + expect_offense(<<~RUBY, attr: attr) expect(page).to have_css("input[#{attr}=foo]") ^^^^^^^^^^^^^^^^^^{attr}^^^^^^ Prefer `have_field` over `have_css`. RUBY @@ -165,7 +165,7 @@ it 'registers an offense when using abstract matcher with ' \ 'first argument is element with multiple replaceable attributes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button[disabled=true][name="foo"]', exact_text: 'foo') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY @@ -173,14 +173,14 @@ it 'registers an offense when using abstract matcher with ' \ 'first argument is element with multiple brackets' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button[name="bar[baz][qux]"]', exact_text: 'foo') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY end it 'registers an offense when using abstract matcher with state' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button[disabled=true]', exact_text: 'foo') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY @@ -188,7 +188,7 @@ it 'registers an offense when using abstract matcher with ' \ 'first argument is element with replaceable pseudo-classes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button:not([disabled=true])', exact_text: 'bar') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. RUBY @@ -196,7 +196,7 @@ it 'registers an offense when using abstract matcher with ' \ 'first argument is element with multiple replaceable pseudo-classes' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('button:not([disabled=true]):enabled') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. expect(page).to have_css('button:not([disabled=false]):disabled') @@ -215,21 +215,21 @@ it 'does not register an offense when using abstract matcher with ' \ 'first argument is element with replaceable pseudo-classes' \ 'and not boolean attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('button:not([name="foo"][disabled])') RUBY end it 'does not register an offense when using abstract matcher with ' \ 'first argument is element with multiple nonreplaceable pseudo-classes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('button:first-of-type:not([disabled])') RUBY end it 'does not register an offense for abstract matcher when ' \ 'first argument is element with nonreplaceable attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('button[disabled]') expect(page).to have_css('button[data-disabled]') expect(page).to have_css('button[foo=bar]') @@ -239,7 +239,7 @@ it 'does not register an offense for abstract matcher when ' \ 'first argument is element with multiple nonreplaceable attributes' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('button[disabled=true][foo]') expect(page).to have_css('button[foo][disabled=true]') expect(page).to have_css('button[foo][disabled=true][bar]') @@ -250,7 +250,7 @@ it 'does not register an offense for abstract matcher when ' \ 'first argument is element with sub matcher' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('button body') expect(page).to have_css('a,h1') expect(page).to have_css('table>tr') @@ -260,14 +260,14 @@ it 'does not register an offense for abstract matcher when ' \ 'first argument is dstr' do - expect_no_offenses(<<-'RUBY') + expect_no_offenses(<<~'RUBY') expect(page).to have_css(%{a[href="#{foo}"]}, text: "bar") RUBY end it 'does not register an offense for abstract matcher when ' \ 'exact_text: /some regex/' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('a', class: 'cls', exact_text: /some regex/) expect(page).to have_css('button', exact_text: /some regex/, class: 'cls') RUBY @@ -275,7 +275,7 @@ it 'does not register an offense for abstract matcher when ' \ 'text: /some regex/' do - expect_no_offenses(<<-RUBY) + expect_no_offenses(<<~RUBY) expect(page).to have_css('select', class: 'cls', text: /some regex/) expect(page).to have_css('table', text: /some regex/, class: 'cls') RUBY diff --git a/spec/rubocop/cop/capybara/visibility_matcher_spec.rb b/spec/rubocop/cop/capybara/visibility_matcher_spec.rb index 68a1f957..e232fca9 100644 --- a/spec/rubocop/cop/capybara/visibility_matcher_spec.rb +++ b/spec/rubocop/cop/capybara/visibility_matcher_spec.rb @@ -2,21 +2,21 @@ RSpec.describe RuboCop::Cop::Capybara::VisibilityMatcher do it 'registers an offense when using `visible: true`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_selector('.my_element', visible: true) ^^^^^^^^^^^^^ Use `:visible` instead of `true`. RUBY end it 'registers an offense when using `visible: false`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_selector('.my_element', visible: false) ^^^^^^^^^^^^^^ Use `:all` or `:hidden` instead of `false`. RUBY end it 'recognizes multiple matchers' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_css('.profile', visible: false) ^^^^^^^^^^^^^^ Use `:all` or `:hidden` instead of `false`. expect(page).to have_xpath('.//profile', visible: false) @@ -39,7 +39,7 @@ end it 'recognizes multiple negative matchers' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_no_css('.profile', visible: false) ^^^^^^^^^^^^^^ Use `:all` or `:hidden` instead of `false`. expect(page).to have_no_xpath('.//profile', visible: false) @@ -62,14 +62,14 @@ end it 'registers an offense when using a selector`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_selector(:css, '.my_element', visible: false) ^^^^^^^^^^^^^^ Use `:all` or `:hidden` instead of `false`. RUBY end it 'registers an offense when using a using multiple options`' do - expect_offense(<<-RUBY) + expect_offense(<<~RUBY) expect(page).to have_selector('.my_element', count: 1, visible: false, normalize_ws: true) ^^^^^^^^^^^^^^ Use `:all` or `:hidden` instead of `false`. RUBY