Skip to content

Commit 6c5bea8

Browse files
committed
Standard: Fix remaining offenses
1 parent 34a7fc4 commit 6c5bea8

File tree

5 files changed

+12
-31
lines changed

5 files changed

+12
-31
lines changed

.standard_todo.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

lib/migration_tools/migration_extension.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module MigrationExtension
44

55
def group(arg = nil)
66
unless MigrationTools::MIGRATION_GROUPS.member?(arg.to_s)
7-
raise "Invalid group \"#{arg.to_s}\" - valid groups are #{MigrationTools::MIGRATION_GROUPS.inspect}"
7+
raise "Invalid group \"#{arg}\" - valid groups are #{MigrationTools::MIGRATION_GROUPS.inspect}"
88
end
99

1010
self.migration_group = arg.to_s
@@ -30,4 +30,4 @@ def migration_group
3030
self.class.migration_group
3131
end
3232
end
33-
ActiveRecord::MigrationProxy.delegate :migration_group, :to => :migration
33+
ActiveRecord::MigrationProxy.delegate :migration_group, to: :migration

lib/migration_tools/tasks.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def define_migrate_list
6464
namespace :db do
6565
namespace :migrate do
6666
desc "Lists pending migrations"
67-
task :list => :environment do
67+
task list: :environment do
6868
if pending_migrations.empty?
6969
notify "Your database schema is up to date", group
7070
else
@@ -82,7 +82,7 @@ def define_migrate_group
8282
namespace :db do
8383
namespace :migrate do
8484
desc "Runs pending migrations for a given group"
85-
task :group => :environment do
85+
task group: :environment do
8686
if group.empty?
8787
notify "Please specify a migration group"
8888
elsif pending_migrations.empty?
@@ -112,7 +112,7 @@ def define_convenience_tasks
112112
[:list, :group].each do |ns|
113113
namespace ns do
114114
MigrationTools::MIGRATION_GROUPS.each do |migration_group|
115-
desc "#{ns == :list ? 'Lists' : 'Executes'} the migrations for group #{migration_group}"
115+
desc "#{(ns == :list) ? "Lists" : "Executes"} the migrations for group #{migration_group}"
116116
task migration_group => :environment do
117117
self.group = migration_group.to_s
118118
Rake::Task["db:migrate:#{ns}"].invoke

test/helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
dir = File.expand_path("../migrations", __FILE__)
1313
ActiveRecord::Migrator.migrations_paths.replace([dir])
14-
Dir.glob(File.join(dir, "*.rb")).each { |f| require f }
14+
Dir.glob(File.join(dir, "*.rb")).sort.each { |f| require f }
1515

1616
ActiveRecord::Migration.verbose = false

test/test_migration_tools.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
ENV["GROUP"] = nil
66

77
ActiveRecord::Base.establish_connection(
8-
:adapter => "sqlite3",
9-
:database => ":memory:"
8+
adapter: "sqlite3",
9+
database: ":memory:"
1010
)
1111

1212
Rake::Task.clear
@@ -40,12 +40,10 @@ def migration_proxy(m)
4040
end
4141

4242
it "runtime_checking" do
43-
begin
44-
eval("class Kappa < MIGRATION_CLASS; group 'drunk'; end")
45-
fail "You should not be able to specify custom groups"
46-
rescue RuntimeError => e
47-
assert e.message.index('Invalid group "drunk" - valid groups are ["before", "during", "after", "change"]')
48-
end
43+
eval("class Kappa < MIGRATION_CLASS; group 'drunk'; end", binding, __FILE__, __LINE__)
44+
fail "You should not be able to specify custom groups"
45+
rescue RuntimeError => e
46+
assert e.message.index('Invalid group "drunk" - valid groups are ["before", "during", "after", "change"]')
4947
end
5048

5149
it "migration_proxy_delegation" do

0 commit comments

Comments
 (0)