Skip to content

Commit

Permalink
Merge pull request #64 from kjrocker/rubocop
Browse files Browse the repository at this point in the history
Fix up rubocop violations
  • Loading branch information
james2m authored Jun 26, 2017
2 parents 2062819 + 14f561f commit 8ee8bfb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
inherit_from: .rubocop_todo.yml
Style/StringLiteral:
Enabled: true
EnforcedStyle: single_quotes
Style/MutableConstant:
Exclude:
- 'lib/seedbank/version.rb'
Lint/ScriptPermission:
Exclude:
- 'test/dummy/Rakefile'
Metrics/LineLength:
Exclude:
- 'test/**/*'
Max: 132
Style/ConditionalAssignment:
Enabled: false
Layout/EmptyLineAfterMagicComment:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gemspec
gem 'rubocop', group: :development

# for CRuby, Rubinius, including Windows and RubyInstaller
gem 'sqlite3', platform: [:ruby, :mswin, :mingw]
gem 'sqlite3', platform: %i[ruby mswin mingw]

# for JRuby
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
4 changes: 2 additions & 2 deletions seedbank.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Gem::Specification.new do |spec|
spec.email = ['[[email protected]']
spec.required_ruby_version = '>= 2.1'
spec.summary = 'Generate seeds data for your Ruby application.'
spec.description = %{
spec.description = %(
Adds simple rake commands for seeding your database. Simple dependencies let you organise your seeds.
If you are using Rails, Seedbank extends Rails seeds and lets you add seeds for each environment.
}
)
spec.date = `git log -1 --format="%cd" --date=short lib/seedbank/version.rb`
spec.homepage = 'http://github.com/james2m/seedbank'
spec.license = 'MIT'
Expand Down
4 changes: 2 additions & 2 deletions test/lib/seedbank/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

describe 'in an environment directory' do
let(:seed_file) { File.expand_path('development/users.seeds.rb', Seedbank.seeds_root) }
let(:seed_namespace) { %w(development) }
let(:seed_namespace) { %w[development] }

it 'returns the enviroment scope' do
subject.must_equal seed_namespace
Expand All @@ -19,7 +19,7 @@

describe 'in a nested directory' do
let(:seed_file) { File.expand_path('development/shared/accounts.seeds.rb', Seedbank.seeds_root) }
let(:seed_namespace) { %w(development shared) }
let(:seed_namespace) { %w[development shared] }

it 'returns the nested scope' do
subject.must_equal seed_namespace
Expand Down
2 changes: 1 addition & 1 deletion test/lib/seedbank/runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def FakeModel.calling_method(*_args); end

before { runner.let(:existing) {} }

%w(existing let! let evaluate after extend).each do |name|
%w[existing let! let evaluate after extend].each do |name|
it 'raises ArgumentError' do
assert_raises(ArgumentError, Regexp.new(name)) do
runner.let(name)
Expand Down
18 changes: 9 additions & 9 deletions test/lib/tasks/seed_rake_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def self.glob_dummy_seeds
end

describe 'seeds with dependency' do
subject { Rake.application.tasks_in_scope(defined?(Rake::Scope) ? Rake::Scope.new('db:seed') : %w(db seed)) }
subject { Rake.application.tasks_in_scope(defined?(Rake::Scope) ? Rake::Scope.new('db:seed') : %w[db seed]) }

it 'creates all the seed tasks' do
seeds = %w(db:seed:circular1 db:seed:circular2 db:seed:common db:seed:dependency db:seed:dependency2
seeds = %w[db:seed:circular1 db:seed:circular2 db:seed:common db:seed:dependency db:seed:dependency2
db:seed:dependent db:seed:dependent_on_nested db:seed:dependent_on_several db:seed:development
db:seed:development:users db:seed:no_block db:seed:original db:seed:reference_memos db:seed:with_block_memo db:seed:with_inline_memo)
db:seed:development:users db:seed:no_block db:seed:original db:seed:reference_memos db:seed:with_block_memo db:seed:with_inline_memo]

subject.map(&:to_s).must_equal seeds
end
Expand All @@ -35,7 +35,7 @@ def self.glob_dummy_seeds
subject { Rake.application.lookup(['db', 'seed', seed].join(':')) }

it 'is dependent on db:abort_if_pending_migrations' do
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
end
end
end
Expand Down Expand Up @@ -79,7 +79,7 @@ def setup
subject { Rake::Task['db:seed:original'] }

it 'is only dependent on db:abort_if_pending_migrations' do
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
end

it 'runs within Seedbank::Runner' do
Expand All @@ -96,7 +96,7 @@ def setup
end

it 'is still only dependent on db:abort_if_pending_migrations' do
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
end

it 'still runs within Seedbank::Runner' do
Expand All @@ -122,7 +122,7 @@ def setup
subject { Rake.application.lookup(['db', 'seed', environment, seed].join(':')) }

it 'is dependent on db:abort_if_pending_migrations' do
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations) if subject
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations] if subject
end
end
end
Expand All @@ -147,7 +147,7 @@ def setup

describe 'when no environment seeds are defined' do
it 'is dependent on db:seed:common' do
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations db:seed:common)
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations db:seed:common]
end
end

Expand All @@ -157,7 +157,7 @@ def setup
Rake.application.clear
silence_warnings { Dummy::Application.load_tasks }

subject.prerequisites.must_equal %w(db:abort_if_pending_migrations db:seed:common db:seed:development)
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations db:seed:common db:seed:development]
end
end
end
Expand Down

0 comments on commit 8ee8bfb

Please sign in to comment.