Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/rails/convert_rails_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

Synvert::Rewriter.new 'rails', 'convert_rails_logger' do
description <<~EOS
It converts RAILS_DEFAULT_LOGGER to Rails.logger.
It converts RAILS_DEFAULT_LOGGER to Rails.logger.

```ruby
RAILS_DEFAULT_LOGGER
```
```ruby
RAILS_DEFAULT_LOGGER
```

=>
=>

```ruby
Rails.logger
```
```ruby
Rails.logger
```
EOS

if_gem 'rails', { gte: '2.3.0' }
Expand Down
12 changes: 6 additions & 6 deletions spec/rails/add_application_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
let(:fake_file_path) { 'app/jobs/application_job.rb' }
let(:test_content) { nil }
let(:test_rewritten_content) { <<~EOS }
class ApplicationJob < ActiveJob::Base
end
class ApplicationJob < ActiveJob::Base
end
EOS

include_examples 'convertable'
Expand All @@ -19,12 +19,12 @@ class ApplicationJob < ActiveJob::Base
context 'rename ActiveJob::Base' do
let(:fake_file_path) { 'app/jobs/post_job.rb' }
let(:test_content) { <<~EOS }
class PostJob < ActiveJob::Base
end
class PostJob < ActiveJob::Base
end
EOS
let(:test_rewritten_content) { <<~EOS }
class PostJob < ApplicationJob
end
class PostJob < ApplicationJob
end
EOS

include_examples 'convertable'
Expand Down
14 changes: 7 additions & 7 deletions spec/rails/add_application_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
let(:fake_file_path) { 'app/models/application_record.rb' }
let(:test_content) { nil }
let(:test_rewritten_content) { <<~EOS }
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
EOS

include_examples 'convertable'
Expand All @@ -20,12 +20,12 @@ class ApplicationRecord < ActiveRecord::Base
context 'rename ActiveRecord::Base' do
let(:fake_file_path) { 'app/models/post.rb' }
let(:test_content) { <<~EOS }
class Post < ActiveRecord::Base
end
class Post < ActiveRecord::Base
end
EOS
let(:test_rewritten_content) { <<~EOS }
class Post < ApplicationRecord
end
class Post < ApplicationRecord
end
EOS

include_examples 'convertable'
Expand Down
16 changes: 8 additions & 8 deletions spec/rails/upgrade_3_0_to_3_1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
'
}
let(:wrap_parameters_rewritten_content) { <<~EOS }
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end

# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end
EOS
let(:session_store_content) {
"
Expand Down
20 changes: 10 additions & 10 deletions spec/ruby/new_2_2_hash_syntax_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
RSpec.describe 'Uses ruby 2.2 new hash synax' do
let(:rewriter_name) { 'ruby/new_2_2_hash_syntax' }
let(:test_content) { <<~'EOS' }
{ :foo => 'bar', 'foo' => 'bar' }
{ :key1 => 'value1', :key2 => 'value2' }
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
{ :"foo-#{key}" => 'foo_value', :"bar-key" => 42, :"a\tb" => false, :"c'd" => nil }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
{ :foo => 'bar', 'foo' => 'bar' }
{ :key1 => 'value1', :key2 => 'value2' }
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
{ :"foo-#{key}" => 'foo_value', :"bar-key" => 42, :"a\tb" => false, :"c'd" => nil }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
EOS
let(:test_rewritten_content) { <<~'EOS' }
{ foo: 'bar', 'foo' => 'bar' }
{ key1: 'value1', key2: 'value2' }
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
{ foo: 'bar', 'foo' => 'bar' }
{ key1: 'value1', key2: 'value2' }
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
EOS

before do
Expand Down