Skip to content

Commit

Permalink
Fix some code offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
waiting-for-dev committed Jun 2, 2021
1 parent 770fcb6 commit 4257935
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
24 changes: 12 additions & 12 deletions core/lib/generators/solidus/update/update_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ class UpdateGenerator < ::Rails::Generators::Base
source_root File.expand_path('templates', __dir__)

class_option :from,
type: :string,
banner: 'The version your are updating from. E.g. 2.11.10'
type: :string,
banner: 'The version your are updating from. E.g. 2.11.10'

class_option :initializer_basename,
type: :string,
default: 'new_solidus_defaults',
banner: 'The name for the new initializer'
type: :string,
default: 'new_solidus_defaults',
banner: 'The name for the new initializer'

class_option :to,
type: :string,
default: Spree.solidus_version,
hide: true
type: :string,
default: Spree.solidus_version,
hide: true

class_option :initializer_directory,
type: :string,
default: 'config/initializers/',
hide: true
type: :string,
default: 'config/initializers/',
hide: true

def create_new_defaults_initializer
from = options[:from]
Expand All @@ -38,7 +38,7 @@ def create_new_defaults_initializer
@api_changes = api_changes_template(from, to)

template 'config/initializers/new_solidus_defaults.rb.tt',
File.join(options[:initializer_directory], "#{options[:initializer_basename]}.rb")
File.join(options[:initializer_directory], "#{options[:initializer_basename]}.rb")
end

private
Expand Down
58 changes: 29 additions & 29 deletions core/spec/lib/generators/solidus/update/update_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RSpec.describe Solidus::UpdateGenerator do
let(:initializer_directory) { Rails.root.join('tmp') }
let(:initializer) { File.join(initializer_directory, 'new_solidus_defaults.rb') }
let(:delete_initializer) { proc { File.delete(initializer) if File.exists?(initializer) }}
let(:delete_initializer) { proc { File.delete(initializer) if File.exist?(initializer) } }
let(:invoke) do
lambda do |from, to|
Rails::Generators.invoke('solidus:update', [
Expand All @@ -32,10 +32,10 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree.config do |config|
config.load_defaults('2.0')
# config.foo = false
end
Spree.config do |config|
config.load_defaults('2.0')
# config.foo = false
end
RUBY
)
end
Expand All @@ -48,9 +48,9 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree.config do |config|
# No changes
end
Spree.config do |config|
# No changes
end
RUBY
)
end
Expand All @@ -69,10 +69,10 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Frontend::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
Spree::Frontend::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
RUBY
)
end
Expand All @@ -85,9 +85,9 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Frontend::Config.configure do |config|
# No changes
end
Spree::Frontend::Config.configure do |config|
# No changes
end
RUBY
)
end
Expand All @@ -106,10 +106,10 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Backend::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
Spree::Backend::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
RUBY
)
end
Expand All @@ -122,9 +122,9 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Backend::Config.configure do |config|
# No changes
end
Spree::Backend::Config.configure do |config|
# No changes
end
RUBY
)
end
Expand All @@ -143,10 +143,10 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Api::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
Spree::Api::Config.configure do |config|
config.load_defaults('2.0')
# config.foo = false
end
RUBY
)
end
Expand All @@ -159,9 +159,9 @@

expect(File.read(initializer)).to include(
<<~RUBY
Spree::Api::Config.configure do |config|
# No changes
end
Spree::Api::Config.configure do |config|
# No changes
end
RUBY
)
end
Expand Down

0 comments on commit 4257935

Please sign in to comment.