Skip to content

Commit

Permalink
test: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
aki77 committed Apr 4, 2023
1 parent 17ab06d commit 2ad1c6c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions spec/rubocop/cop/sgcop/capybara/sleep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
it do
click_on 'button'
sleep 10
^^^^^ Do not use `sleep` in spec.
^^^^^ Sgcop/Capybara/Sleep: Do not use `sleep` in spec.
end
RUBY
end
Expand All @@ -18,7 +18,7 @@
it do
click_on 'button'
Kernel.sleep 10
^^^^^ Do not use `sleep` in spec.
^^^^^ Sgcop/Capybara/Sleep: Do not use `sleep` in spec.
end
RUBY
end
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/sgcop/link_to_ujs_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
it 'methodオプションは警告' do
expect_offense(<<~RUBY)
link_to 'title', url, method: :delete
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Deprecated: Rails UJS Attributes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/UjsOptions: Deprecated: Rails UJS Attributes.
RUBY
end

it 'remoteオプションは警告' do
expect_offense(<<~RUBY)
link_to 'title', url, remote: true
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Deprecated: Rails UJS Attributes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/UjsOptions: Deprecated: Rails UJS Attributes.
RUBY
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/request_remote_ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
expect_offense(<<~RUBY)
def log
logger.info request.remote_addr
^^^^^^^^^^^^^^^^^^^ Use `request.remote_ip` instead of `request.remote_addr`.
^^^^^^^^^^^^^^^^^^^ Sgcop/RequestRemoteIp: Use `request.remote_ip` instead of `request.remote_addr`.
end
RUBY
end
Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/cop/sgcop/simple_form_association_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
expect_offense(<<~RUBY)
simple_form_for user do |f|
f.association :group
^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
RUBY
end
Expand All @@ -35,7 +35,7 @@
expect_offense(<<~RUBY)
simple_nested_form_for user do |f|
f.association :group
^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
RUBY
end
Expand Down Expand Up @@ -63,7 +63,7 @@
simple_form_for user do |f|
f.simple_fields_for :posts do |ff|
ff.association :category
^^^^^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
end
RUBY
Expand Down
10 changes: 5 additions & 5 deletions spec/rubocop/cop/sgcop/simple_format_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
expect_offense(<<~RUBY)
def html_format(text)
simple_format(text)
^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
end
RUBY
end
Expand All @@ -16,7 +16,7 @@ def html_format(text)
expect_offense(<<~RUBY)
def html_format(object)
simple_format(object.body)
^^^^^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
end
RUBY
end
Expand All @@ -30,21 +30,21 @@ def html_format(object)
it 'simple_formatにエスケープメソッド以外の結果が渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(t(text))
^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end

it 'simple_formatにインスタンス変数が渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(@object)
^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end

it 'simple_formatにインスタンス変数のメソッドが渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(@object.body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end
end
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/unscoped_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class BooksController < ApplicationController
def index
@books = books.unscoped.default_order
^^^^^^^^^^^^^^ Do not use `unscoped`
^^^^^^^^^^^^^^ Sgcop/Unscoped: Do not use `unscoped`
end
end
RUBY
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/whenever_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set :chronic_options, hours24: true
every 1.day, at: '7:10 am' do
^^^^^^^^^^^^^ Use 24-hour clock to avoid errors.
^^^^^^^^^^^^^ Sgcop/Whenever: Use 24-hour clock to avoid errors.
rake 'sgcop'
end
RUBY
Expand Down

0 comments on commit 2ad1c6c

Please sign in to comment.