Skip to content

Commit 8ee8bfb

Browse files
authored
Merge pull request james2m#64 from kjrocker/rubocop
Fix up rubocop violations
2 parents 2062819 + 14f561f commit 8ee8bfb

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

.rubocop.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
inherit_from: .rubocop_todo.yml
2+
Style/StringLiteral:
3+
Enabled: true
4+
EnforcedStyle: single_quotes
5+
Style/MutableConstant:
6+
Exclude:
7+
- 'lib/seedbank/version.rb'
8+
Lint/ScriptPermission:
9+
Exclude:
10+
- 'test/dummy/Rakefile'
211
Metrics/LineLength:
312
Exclude:
413
- 'test/**/*'
514
Max: 132
615
Style/ConditionalAssignment:
716
Enabled: false
17+
Layout/EmptyLineAfterMagicComment:
18+
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gemspec
77
gem 'rubocop', group: :development
88

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

1212
# for JRuby
1313
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby

seedbank.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Gem::Specification.new do |spec|
1212
spec.email = ['[james2mccarthy@gmail.com']
1313
spec.required_ruby_version = '>= 2.1'
1414
spec.summary = 'Generate seeds data for your Ruby application.'
15-
spec.description = %{
15+
spec.description = %(
1616
Adds simple rake commands for seeding your database. Simple dependencies let you organise your seeds.
1717
If you are using Rails, Seedbank extends Rails seeds and lets you add seeds for each environment.
18-
}
18+
)
1919
spec.date = `git log -1 --format="%cd" --date=short lib/seedbank/version.rb`
2020
spec.homepage = 'https://github.com/james2m/seedbank'
2121
spec.license = 'MIT'

test/lib/seedbank/dsl_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

1515
it 'returns the enviroment scope' do
1616
subject.must_equal seed_namespace
@@ -19,7 +19,7 @@
1919

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

2424
it 'returns the nested scope' do
2525
subject.must_equal seed_namespace

test/lib/seedbank/runner_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def FakeModel.calling_method(*_args); end
9797

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

100-
%w(existing let! let evaluate after extend).each do |name|
100+
%w[existing let! let evaluate after extend].each do |name|
101101
it 'raises ArgumentError' do
102102
assert_raises(ArgumentError, Regexp.new(name)) do
103103
runner.let(name)

test/lib/tasks/seed_rake_test.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ def self.glob_dummy_seeds
1616
end
1717

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

2121
it 'creates all the seed tasks' do
22-
seeds = %w(db:seed:circular1 db:seed:circular2 db:seed:common db:seed:dependency db:seed:dependency2
22+
seeds = %w[db:seed:circular1 db:seed:circular2 db:seed:common db:seed:dependency db:seed:dependency2
2323
db:seed:dependent db:seed:dependent_on_nested db:seed:dependent_on_several db:seed:development
24-
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)
24+
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]
2525

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

3737
it 'is dependent on db:abort_if_pending_migrations' do
38-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
38+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
3939
end
4040
end
4141
end
@@ -79,7 +79,7 @@ def setup
7979
subject { Rake::Task['db:seed:original'] }
8080

8181
it 'is only dependent on db:abort_if_pending_migrations' do
82-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
82+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
8383
end
8484

8585
it 'runs within Seedbank::Runner' do
@@ -96,7 +96,7 @@ def setup
9696
end
9797

9898
it 'is still only dependent on db:abort_if_pending_migrations' do
99-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations)
99+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations]
100100
end
101101

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

124124
it 'is dependent on db:abort_if_pending_migrations' do
125-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations) if subject
125+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations] if subject
126126
end
127127
end
128128
end
@@ -147,7 +147,7 @@ def setup
147147

148148
describe 'when no environment seeds are defined' do
149149
it 'is dependent on db:seed:common' do
150-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations db:seed:common)
150+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations db:seed:common]
151151
end
152152
end
153153

@@ -157,7 +157,7 @@ def setup
157157
Rake.application.clear
158158
silence_warnings { Dummy::Application.load_tasks }
159159

160-
subject.prerequisites.must_equal %w(db:abort_if_pending_migrations db:seed:common db:seed:development)
160+
subject.prerequisites.must_equal %w[db:abort_if_pending_migrations db:seed:common db:seed:development]
161161
end
162162
end
163163
end

0 commit comments

Comments
 (0)