sequel-rails 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +13 -0
  4. data/.travis.yml +15 -43
  5. data/Gemfile +10 -10
  6. data/History.md +8 -0
  7. data/README.md +36 -0
  8. data/Rakefile +70 -2
  9. data/ci/rails-3.2.gemfile +15 -12
  10. data/ci/rails-4.0.gemfile +12 -12
  11. data/config.ru +1 -1
  12. data/lib/generators/sequel/migration/migration_generator.rb +10 -13
  13. data/lib/generators/sequel/model/model_generator.rb +11 -9
  14. data/lib/generators/sequel/observer/observer_generator.rb +6 -7
  15. data/lib/generators/sequel/session_migration/session_migration_generator.rb +30 -0
  16. data/lib/generators/sequel/session_migration/templates/migration.rb.erb +10 -0
  17. data/lib/generators/sequel.rb +9 -13
  18. data/lib/sequel-rails.rb +1 -1
  19. data/lib/sequel_rails/configuration.rb +29 -35
  20. data/lib/sequel_rails/migrations.rb +4 -4
  21. data/lib/sequel_rails/railtie.rb +16 -20
  22. data/lib/sequel_rails/railties/controller_runtime.rb +2 -8
  23. data/lib/sequel_rails/railties/database.rake +42 -46
  24. data/lib/sequel_rails/railties/i18n_support.rb +0 -2
  25. data/lib/sequel_rails/railties/legacy_model_config.rb +1 -1
  26. data/lib/sequel_rails/railties/log_subscriber.rb +5 -9
  27. data/lib/sequel_rails/sequel/database/active_support_notification.rb +4 -6
  28. data/lib/sequel_rails/sequel/plugins/rails_extensions.rb +2 -3
  29. data/lib/sequel_rails/session_store.rb +6 -42
  30. data/lib/sequel_rails/shellwords.rb +3 -3
  31. data/lib/sequel_rails/storage/abstract.rb +14 -16
  32. data/lib/sequel_rails/storage/jdbc.rb +8 -10
  33. data/lib/sequel_rails/storage/mysql.rb +13 -15
  34. data/lib/sequel_rails/storage/postgres.rb +42 -45
  35. data/lib/sequel_rails/storage/sqlite.rb +0 -1
  36. data/lib/sequel_rails/storage.rb +10 -10
  37. data/lib/sequel_rails/version.rb +1 -1
  38. data/lib/sequel_rails.rb +3 -3
  39. data/rubocop-todo.yml +24 -0
  40. data/sequel-rails.gemspec +21 -19
  41. data/spec/internal/Rakefile +2 -2
  42. data/spec/internal/config/initializers/session.rb +1 -1
  43. data/spec/internal/db/schema.rb.init +6 -0
  44. data/spec/lib/generators/sequel/migration_spec.rb +77 -77
  45. data/spec/lib/generators/sequel/session_migration_spec.rb +41 -0
  46. data/spec/lib/sequel_rails/configuration_spec.rb +161 -161
  47. data/spec/lib/sequel_rails/jdbc_spec.rb +4 -4
  48. data/spec/lib/sequel_rails/migrations_spec.rb +29 -29
  49. data/spec/lib/sequel_rails/railtie_spec.rb +31 -29
  50. data/spec/lib/sequel_rails/railties/database_rake_spec.rb +16 -15
  51. data/spec/lib/sequel_rails/railties/log_subscriber_spec.rb +6 -6
  52. data/spec/lib/sequel_rails/storage/mysql_spec.rb +31 -31
  53. data/spec/lib/sequel_rails/storage/postgres_spec.rb +67 -67
  54. data/spec/lib/sequel_rails/storage/sqlite_spec.rb +40 -40
  55. data/spec/lib/sequel_rails/storage_spec.rb +77 -89
  56. data/spec/spec_helper.rb +16 -10
  57. metadata +61 -28
  58. data/tasks/spec.rake +0 -81
@@ -1,14 +1,14 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe SequelRails do
4
4
 
5
- describe ".setup" do
6
- let(:environment) { "development" }
5
+ describe '.setup' do
6
+ let(:environment) { 'development' }
7
7
  let(:configuration) { SequelRails::Configuration.new }
8
8
 
9
- it "delegates to current configuration" do
9
+ it 'delegates to current configuration' do
10
10
  SequelRails.configuration = configuration
11
- configuration.should_receive(:connect).with(environment)
11
+ expect(configuration).to receive(:connect).with(environment)
12
12
  SequelRails.setup environment
13
13
  end
14
14
  end
@@ -17,152 +17,126 @@ end
17
17
 
18
18
  describe SequelRails::Configuration do
19
19
 
20
- describe "#schema_dump" do
21
- before{ Rails.stub(:env).and_return environment }
22
- subject{ described_class.new }
20
+ describe '#schema_dump' do
21
+ before { allow(Rails).to receive(:env).and_return(environment) }
22
+ subject { described_class.new }
23
23
 
24
- context "in test environment" do
25
- let(:environment) { "test" }
26
- it "defaults to false" do
27
- subject.schema_dump.should be_false
24
+ context 'in test environment' do
25
+ let(:environment) { 'test' }
26
+ it 'defaults to false' do
27
+ expect(subject.schema_dump).to be_false
28
28
  end
29
- it "can be assigned" do
29
+ it 'can be assigned' do
30
30
  subject.schema_dump = true
31
- subject.schema_dump.should be_true
31
+ expect(subject.schema_dump).to be_true
32
32
  end
33
- it "can be set from merging another hash" do
33
+ it 'can be set from merging another hash' do
34
34
  subject.merge!(:schema_dump => true)
35
- subject.schema_dump.should be_true
35
+ expect(subject.schema_dump).to be_true
36
36
  end
37
37
  end
38
38
 
39
- context "in production environment" do
40
- let(:environment) { "production" }
41
- it "defaults to false" do
42
- subject.schema_dump.should be_false
39
+ context 'in production environment' do
40
+ let(:environment) { 'production' }
41
+ it 'defaults to false' do
42
+ expect(subject.schema_dump).to be_false
43
43
  end
44
- it "can be assigned" do
44
+ it 'can be assigned' do
45
45
  subject.schema_dump = true
46
- subject.schema_dump.should be_true
46
+ expect(subject.schema_dump).to be_true
47
47
  end
48
- it "can be set from merging another hash" do
48
+ it 'can be set from merging another hash' do
49
49
  subject.merge!(:schema_dump => true)
50
- subject.schema_dump.should be_true
50
+ expect(subject.schema_dump).to be_true
51
51
  end
52
52
  end
53
53
 
54
- context "in other environments" do
55
- let(:environment) { "development" }
56
- it "defaults to true" do
57
- subject.schema_dump.should be_true
54
+ context 'in other environments' do
55
+ let(:environment) { 'development' }
56
+ it 'defaults to true' do
57
+ expect(subject.schema_dump).to be_true
58
58
  end
59
- it "can be assigned" do
59
+ it 'can be assigned' do
60
60
  subject.schema_dump = false
61
- subject.schema_dump.should be_false
61
+ expect(subject.schema_dump).to be_false
62
62
  end
63
- it "can be set from merging another hash" do
63
+ it 'can be set from merging another hash' do
64
64
  subject.merge!(:schema_dump => false)
65
- subject.schema_dump.should be_false
65
+ expect(subject.schema_dump).to be_false
66
66
  end
67
67
  end
68
68
  end
69
69
 
70
- describe "#load_database_tasks" do
71
- subject{ described_class.new }
70
+ describe '#load_database_tasks' do
71
+ subject { described_class.new }
72
72
 
73
- it "defaults to true" do
74
- subject.load_database_tasks.should be_true
73
+ it 'defaults to true' do
74
+ expect(subject.load_database_tasks).to be_true
75
75
  end
76
- it "can be assigned" do
76
+ it 'can be assigned' do
77
77
  subject.load_database_tasks = false
78
- subject.load_database_tasks.should be_false
78
+ expect(subject.load_database_tasks).to be_false
79
79
  end
80
- it "can be set from merging another hash" do
80
+ it 'can be set from merging another hash' do
81
81
  subject.merge!(:load_database_tasks => false)
82
- subject.load_database_tasks.should be_false
82
+ expect(subject.load_database_tasks).to be_false
83
83
  end
84
84
  end
85
85
 
86
- describe "#connect" do
86
+ describe '#connect' do
87
87
  let(:environments) do
88
88
  {
89
- "development" => {
90
- "adapter" => "postgres",
91
- "owner" => (ENV["TEST_OWNER"] || ENV["USER"]),
92
- "username" => (ENV["TEST_OWNER"] || ENV["USER"]),
93
- "database" => "sequel_rails_test_storage_dev",
94
- "host" => "127.0.0.1",
89
+ 'development' => {
90
+ 'adapter' => 'postgres',
91
+ 'owner' => (ENV['TEST_OWNER'] || ENV['USER']),
92
+ 'username' => (ENV['TEST_OWNER'] || ENV['USER']),
93
+ 'database' => 'sequel_rails_test_storage_dev',
94
+ 'host' => '127.0.0.1',
95
95
  },
96
- "test" => {
97
- "adapter" => "postgres",
98
- "owner" => (ENV["TEST_OWNER"] || ENV["USER"]),
99
- "username" => (ENV["TEST_OWNER"] || ENV["USER"]),
100
- "database" => "sequel_rails_test_storage_test",
101
- "host" => "127.0.0.1",
96
+ 'test' => {
97
+ 'adapter' => 'postgres',
98
+ 'owner' => (ENV['TEST_OWNER'] || ENV['USER']),
99
+ 'username' => (ENV['TEST_OWNER'] || ENV['USER']),
100
+ 'database' => 'sequel_rails_test_storage_test',
101
+ 'host' => '127.0.0.1',
102
102
  },
103
- "remote" => {
104
- "adapter" => "mysql",
105
- "host" => "10.0.0.1",
106
- "database" => "sequel_rails_test_storage_remote",
103
+ 'remote' => {
104
+ 'adapter' => 'mysql',
105
+ 'host' => '10.0.0.1',
106
+ 'database' => 'sequel_rails_test_storage_remote',
107
107
  },
108
- "production" => {
109
- "host" => "10.0.0.1",
110
- "database" => "sequel_rails_test_storage_production",
108
+ 'production' => {
109
+ 'host' => '10.0.0.1',
110
+ 'database' => 'sequel_rails_test_storage_production',
111
111
  },
112
- "url_already_constructed" => {
113
- "adapter" => "adapter_name",
114
- "url" => "jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption"
112
+ 'url_already_constructed' => {
113
+ 'adapter' => 'adapter_name',
114
+ 'url' => 'jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption'
115
115
  },
116
- "bogus" => {},
116
+ 'bogus' => {},
117
117
  }
118
118
  end
119
- let(:is_jruby) { false }
120
-
121
- subject do
122
- config = described_class.new
123
- config.raw = environments
124
- config
125
- end
126
119
 
127
- before { SequelRails.stub(:jruby?).and_return is_jruby }
128
-
129
- shared_examples "max_connections" do
130
- context "with max_connections config option" do
131
- let(:max_connections) { 31337 }
132
- before do
133
- environments[environment]["max_connections"] = 7
134
- subject.max_connections = max_connections
135
- end
120
+ subject { described_class.new.tap { |config| config.raw = environments } }
136
121
 
137
- it "overrides the option from the configuration" do
138
- ::Sequel.should_receive(:connect) do |hash_or_url, *_|
139
- if hash_or_url.is_a? Hash
140
- hash_or_url['max_connections'].should == max_connections
141
- else
142
- hash_or_url.should include("max_connections=#{max_connections}")
143
- end
144
- end
145
- subject.connect environment
146
- end
147
- end
148
- end
122
+ context 'when stubbing SequelRails.jruby?' do
149
123
 
150
- context "for a postgres connection" do
124
+ before { allow(SequelRails).to receive(:jruby?).and_return(is_jruby) }
151
125
 
152
- shared_examples "search_path" do
153
- context "with search_path config option" do
154
- let(:search_path) { ['secret', 'private', 'public'] }
126
+ shared_examples 'max_connections' do
127
+ context 'with max_connections config option' do
128
+ let(:max_connections) { 31_337 }
155
129
  before do
156
- environments[environment]["search_path"] = "private, public"
157
- subject.search_path = search_path
130
+ environments[environment]['max_connections'] = 7
131
+ subject.max_connections = max_connections
158
132
  end
159
133
 
160
- it "overrides the option from the configuration" do
161
- ::Sequel.should_receive(:connect) do |hash_or_url, *_|
134
+ it 'overrides the option from the configuration' do
135
+ expect(::Sequel).to receive(:connect) do |hash_or_url, *_|
162
136
  if hash_or_url.is_a? Hash
163
- hash_or_url['search_path'].should == search_path
137
+ expect(hash_or_url['max_connections']).to eq(max_connections)
164
138
  else
165
- hash_or_url.should include("search_path=secret,private,public")
139
+ expect(hash_or_url).to include("max_connections=#{max_connections}")
166
140
  end
167
141
  end
168
142
  subject.connect environment
@@ -170,109 +144,135 @@ describe SequelRails::Configuration do
170
144
  end
171
145
  end
172
146
 
173
- let(:environment) { 'development' }
174
-
175
- context "in C-Ruby" do
147
+ context 'for a postgres connection' do
176
148
 
177
- include_examples "max_connections"
178
- include_examples "search_path"
149
+ shared_examples 'search_path' do
150
+ context 'with search_path config option' do
151
+ let(:search_path) { %w(secret private public) }
152
+ before do
153
+ environments[environment]['search_path'] = 'private, public'
154
+ subject.search_path = search_path
155
+ end
179
156
 
180
- it "produces a sane config without url" do
181
- ::Sequel.should_receive(:connect) do |hash|
182
- hash['adapter'].should == 'postgres'
157
+ it 'overrides the option from the configuration' do
158
+ expect(::Sequel).to receive(:connect) do |hash_or_url, *_|
159
+ if hash_or_url.is_a? Hash
160
+ expect(hash_or_url['search_path']).to eq(search_path)
161
+ else
162
+ expect(hash_or_url).to include('search_path=secret,private,public')
163
+ end
164
+ end
165
+ subject.connect environment
166
+ end
183
167
  end
184
- subject.connect environment
185
168
  end
186
169
 
187
- end
170
+ let(:environment) { 'development' }
188
171
 
189
- context "in JRuby" do
172
+ context 'in C-Ruby' do
190
173
 
191
- include_examples "max_connections"
192
- include_examples "search_path"
174
+ include_examples 'max_connections'
175
+ include_examples 'search_path'
193
176
 
194
- let(:is_jruby) { true }
177
+ let(:is_jruby) { false }
195
178
 
196
- it "produces an adapter config with a url" do
197
- ::Sequel.should_receive(:connect) do |url, hash|
198
- url.should =~ /^jdbc:postgresql:\/\//
199
- hash['adapter'].should == 'jdbc:postgresql'
200
- hash['host'].should == '127.0.0.1'
179
+ it 'produces a sane config without url' do
180
+ expect(::Sequel).to receive(:connect) do |hash|
181
+ expect(hash['adapter']).to eq('postgres')
182
+ end
183
+ subject.connect environment
201
184
  end
202
- subject.connect environment
185
+
203
186
  end
204
187
 
205
- context "when url is already given" do
188
+ context 'in JRuby' do
206
189
 
207
- let(:environment) { "url_already_constructed" }
190
+ include_examples 'max_connections'
191
+ include_examples 'search_path'
208
192
 
209
- it "does not change the url" do
210
- ::Sequel.should_receive(:connect) do |url, hash|
211
- url.should == "jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption"
212
- hash['adapter'].should == 'jdbc:adapter_name'
193
+ let(:is_jruby) { true }
194
+
195
+ it 'produces an adapter config with a url' do
196
+ expect(::Sequel).to receive(:connect) do |url, hash|
197
+ expect(url).to start_with('jdbc:postgresql://')
198
+ expect(hash['adapter']).to eq('jdbc:postgresql')
199
+ expect(hash['host']).to eq('127.0.0.1')
213
200
  end
214
201
  subject.connect environment
215
202
  end
216
203
 
217
- end
218
- end
219
- end
220
-
221
- context "for a mysql connection" do
204
+ context 'when url is already given' do
222
205
 
223
- let(:environment) { 'remote' }
206
+ let(:environment) { 'url_already_constructed' }
224
207
 
225
- context "in C-Ruby" do
226
-
227
- include_examples "max_connections"
208
+ it 'does not change the url' do
209
+ expect(::Sequel).to receive(:connect) do |url, hash|
210
+ expect(url).to eq('jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption')
211
+ expect(hash['adapter']).to eq('jdbc:adapter_name')
212
+ end
213
+ subject.connect environment
214
+ end
228
215
 
229
- it "produces a config without url" do
230
- ::Sequel.should_receive(:connect) do |hash|
231
- hash['adapter'].should == 'mysql'
232
216
  end
233
- subject.connect environment
234
217
  end
235
218
  end
236
219
 
237
- context "in JRuby" do
220
+ context 'for a mysql connection' do
221
+
222
+ let(:environment) { 'remote' }
223
+
224
+ context 'in C-Ruby' do
238
225
 
239
- include_examples "max_connections"
226
+ include_examples 'max_connections'
240
227
 
241
- let(:is_jruby) { true }
228
+ let(:is_jruby) { false }
242
229
 
243
- it "produces a jdbc mysql config" do
244
- ::Sequel.should_receive(:connect) do |url, hash|
245
- url.should =~ /^jdbc:mysql:\/\//
246
- hash['adapter'].should == 'jdbc:mysql'
247
- hash['database'].should == 'sequel_rails_test_storage_remote'
230
+ it 'produces a config without url' do
231
+ expect(::Sequel).to receive(:connect) do |hash|
232
+ expect(hash['adapter']).to eq('mysql')
233
+ end
234
+ subject.connect environment
248
235
  end
249
- subject.connect environment
250
236
  end
251
237
 
252
- context "when url is already given" do
238
+ context 'in JRuby' do
239
+
240
+ include_examples 'max_connections'
253
241
 
254
- let(:environment) { "url_already_constructed" }
242
+ let(:is_jruby) { true }
255
243
 
256
- it "does not change the url" do
257
- ::Sequel.should_receive(:connect) do |url, hash|
258
- url.should == "jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption"
259
- hash['adapter'].should == 'jdbc:adapter_name'
244
+ it 'produces a jdbc mysql config' do
245
+ expect(::Sequel).to receive(:connect) do |url, hash|
246
+ expect(url).to start_with('jdbc:mysql://')
247
+ expect(hash['adapter']).to eq('jdbc:mysql')
248
+ expect(hash['database']).to eq('sequel_rails_test_storage_remote')
260
249
  end
261
250
  subject.connect environment
262
251
  end
263
252
 
253
+ context 'when url is already given' do
254
+
255
+ let(:environment) { 'url_already_constructed' }
256
+
257
+ it 'does not change the url' do
258
+ expect(::Sequel).to receive(:connect) do |url, hash|
259
+ expect(url).to eq('jdbc:adapter_name://HOST/DB?user=U&password=P&ssl=true&sslfactory=sslFactoryOption')
260
+ expect(hash['adapter']).to eq('jdbc:adapter_name')
261
+ end
262
+ subject.connect environment
263
+ end
264
+ end
264
265
  end
265
266
  end
266
267
  end
267
268
 
268
- describe "after connect hook" do
269
+ describe 'after connect hook' do
269
270
  let(:hook) { double }
270
- let(:environment) { "development" }
271
- before { SequelRails.unstub :jruby? }
271
+ let(:environment) { 'development' }
272
272
 
273
- it "runs hook if provided" do
273
+ it 'runs hook if provided' do
274
274
  subject.after_connect = hook
275
- hook.should_receive(:call)
275
+ expect(hook).to receive(:call)
276
276
  subject.connect environment
277
277
  end
278
278
  end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe SequelRails::Storage::Jdbc do
4
4
  let(:adapter) { 'jdbc:mysql' }
@@ -26,14 +26,14 @@ describe SequelRails::Storage::Jdbc do
26
26
  end
27
27
  let(:store) { described_class.new(config) }
28
28
 
29
- describe "#_root_url" do
29
+ describe '#_root_url' do
30
30
  subject { store._root_url }
31
31
  let(:expected) { "jdbc:mysql://#{host}" }
32
32
 
33
33
  it { should == expected }
34
34
 
35
- context "with ip addresses" do
36
- let(:host) { '127.0.0.1'}
35
+ context 'with ip addresses' do
36
+ let(:host) { '127.0.0.1' }
37
37
 
38
38
  it { should == expected }
39
39
  end
@@ -1,64 +1,64 @@
1
- require "spec_helper"
2
- require "fakefs/spec_helpers"
1
+ require 'spec_helper'
2
+ require 'fakefs/spec_helpers'
3
3
 
4
4
  describe SequelRails::Migrations do
5
5
  let!(:db) { ::Sequel::Model.db }
6
6
 
7
7
  [:migrate_up!, :migrate_down!].each do |migration_method|
8
8
  describe ".#{migration_method}" do
9
- let(:result) { mock :result }
10
- context "with no version specified" do
9
+ let(:result) { double(:result) }
10
+ context 'with no version specified' do
11
11
  let(:opts) { {} }
12
- it "runs migrations using Sequel::Migrator" do
13
- ::Sequel::Migrator.should_receive(:run).with(
14
- db, Rails.root.join("db/migrate"), opts
12
+ it 'runs migrations using Sequel::Migrator' do
13
+ expect(::Sequel::Migrator).to receive(:run).with(
14
+ db, Rails.root.join('db/migrate'), opts
15
15
  ).and_return result
16
- described_class.send(migration_method).should be result
16
+ expect(described_class.send(migration_method)).to be(result)
17
17
  end
18
18
  end
19
- context "with version specified" do
20
- let(:opts) { {:target => 1} }
21
- it "runs migrations using Sequel::Migrator" do
22
- ::Sequel::Migrator.should_receive(:run).with(
23
- db, Rails.root.join("db/migrate"), opts
19
+ context 'with version specified' do
20
+ let(:opts) { { :target => 1 } }
21
+ it 'runs migrations using Sequel::Migrator' do
22
+ expect(::Sequel::Migrator).to receive(:run).with(
23
+ db, Rails.root.join('db/migrate'), opts
24
24
  ).and_return result
25
- described_class.send(migration_method, 1).should be result
25
+ expect(described_class.send(migration_method, 1)).to be(result)
26
26
  end
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
- describe ".pending_migrations?" do
31
+ describe '.pending_migrations?' do
32
32
  include FakeFS::SpecHelpers
33
- let(:path) { Rails.root.join("db/migrate") }
33
+ let(:path) { Rails.root.join('db/migrate') }
34
34
 
35
- it "returns false if no db/migrate directory exists" do
36
- described_class.pending_migrations?.should == false
35
+ it 'returns false if no db/migrate directory exists' do
36
+ expect(described_class).to_not be_pending_migrations
37
37
  end
38
38
 
39
- it "returns false if db/migrate directory exists, but is empty" do
39
+ it 'returns false if db/migrate directory exists, but is empty' do
40
40
  FileUtils.mkdir_p path
41
- described_class.pending_migrations?.should == false
41
+ expect(described_class.pending_migrations?).to be_false
42
42
  end
43
43
 
44
- context "when db/migrate directory exists and contains migrations" do
44
+ context 'when db/migrate directory exists and contains migrations' do
45
45
  before do
46
46
  FileUtils.mkdir_p path
47
47
  FileUtils.touch(File.join(path, 'test_migration.rb'))
48
48
  end
49
49
 
50
- it "returns true if any pending migration" do
51
- ::Sequel::Migrator.should_receive(:is_current?).with(
52
- db, Rails.root.join("db/migrate")
50
+ it 'returns true if any pending migration' do
51
+ expect(::Sequel::Migrator).to receive(:is_current?).with(
52
+ db, Rails.root.join('db/migrate')
53
53
  ).and_return false
54
- described_class.pending_migrations?.should == true
54
+ expect(described_class).to be_pending_migrations
55
55
  end
56
56
 
57
- it "returns false if no pending migration" do
58
- ::Sequel::Migrator.should_receive(:is_current?).with(
59
- db, Rails.root.join("db/migrate")
57
+ it 'returns false if no pending migration' do
58
+ expect(::Sequel::Migrator).to receive(:is_current?).with(
59
+ db, Rails.root.join('db/migrate')
60
60
  ).and_return true
61
- described_class.pending_migrations?.should == false
61
+ expect(described_class).to_not be_pending_migrations
62
62
  end
63
63
  end
64
64
  end