sequel-rails 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +15 -43
- data/Gemfile +10 -10
- data/History.md +8 -0
- data/README.md +36 -0
- data/Rakefile +70 -2
- data/ci/rails-3.2.gemfile +15 -12
- data/ci/rails-4.0.gemfile +12 -12
- data/config.ru +1 -1
- data/lib/generators/sequel/migration/migration_generator.rb +10 -13
- data/lib/generators/sequel/model/model_generator.rb +11 -9
- data/lib/generators/sequel/observer/observer_generator.rb +6 -7
- data/lib/generators/sequel/session_migration/session_migration_generator.rb +30 -0
- data/lib/generators/sequel/session_migration/templates/migration.rb.erb +10 -0
- data/lib/generators/sequel.rb +9 -13
- data/lib/sequel-rails.rb +1 -1
- data/lib/sequel_rails/configuration.rb +29 -35
- data/lib/sequel_rails/migrations.rb +4 -4
- data/lib/sequel_rails/railtie.rb +16 -20
- data/lib/sequel_rails/railties/controller_runtime.rb +2 -8
- data/lib/sequel_rails/railties/database.rake +42 -46
- data/lib/sequel_rails/railties/i18n_support.rb +0 -2
- data/lib/sequel_rails/railties/legacy_model_config.rb +1 -1
- data/lib/sequel_rails/railties/log_subscriber.rb +5 -9
- data/lib/sequel_rails/sequel/database/active_support_notification.rb +4 -6
- data/lib/sequel_rails/sequel/plugins/rails_extensions.rb +2 -3
- data/lib/sequel_rails/session_store.rb +6 -42
- data/lib/sequel_rails/shellwords.rb +3 -3
- data/lib/sequel_rails/storage/abstract.rb +14 -16
- data/lib/sequel_rails/storage/jdbc.rb +8 -10
- data/lib/sequel_rails/storage/mysql.rb +13 -15
- data/lib/sequel_rails/storage/postgres.rb +42 -45
- data/lib/sequel_rails/storage/sqlite.rb +0 -1
- data/lib/sequel_rails/storage.rb +10 -10
- data/lib/sequel_rails/version.rb +1 -1
- data/lib/sequel_rails.rb +3 -3
- data/rubocop-todo.yml +24 -0
- data/sequel-rails.gemspec +21 -19
- data/spec/internal/Rakefile +2 -2
- data/spec/internal/config/initializers/session.rb +1 -1
- data/spec/internal/db/schema.rb.init +6 -0
- data/spec/lib/generators/sequel/migration_spec.rb +77 -77
- data/spec/lib/generators/sequel/session_migration_spec.rb +41 -0
- data/spec/lib/sequel_rails/configuration_spec.rb +161 -161
- data/spec/lib/sequel_rails/jdbc_spec.rb +4 -4
- data/spec/lib/sequel_rails/migrations_spec.rb +29 -29
- data/spec/lib/sequel_rails/railtie_spec.rb +31 -29
- data/spec/lib/sequel_rails/railties/database_rake_spec.rb +16 -15
- data/spec/lib/sequel_rails/railties/log_subscriber_spec.rb +6 -6
- data/spec/lib/sequel_rails/storage/mysql_spec.rb +31 -31
- data/spec/lib/sequel_rails/storage/postgres_spec.rb +67 -67
- data/spec/lib/sequel_rails/storage/sqlite_spec.rb +40 -40
- data/spec/lib/sequel_rails/storage_spec.rb +77 -89
- data/spec/spec_helper.rb +16 -10
- metadata +61 -28
- data/tasks/spec.rake +0 -81
@@ -1,14 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe SequelRails do
|
4
4
|
|
5
|
-
describe
|
6
|
-
let(:environment) {
|
5
|
+
describe '.setup' do
|
6
|
+
let(:environment) { 'development' }
|
7
7
|
let(:configuration) { SequelRails::Configuration.new }
|
8
8
|
|
9
|
-
it
|
9
|
+
it 'delegates to current configuration' do
|
10
10
|
SequelRails.configuration = configuration
|
11
|
-
configuration.
|
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
|
21
|
-
before{ Rails.
|
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
|
25
|
-
let(:environment) {
|
26
|
-
it
|
27
|
-
subject.schema_dump.
|
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
|
29
|
+
it 'can be assigned' do
|
30
30
|
subject.schema_dump = true
|
31
|
-
subject.schema_dump.
|
31
|
+
expect(subject.schema_dump).to be_true
|
32
32
|
end
|
33
|
-
it
|
33
|
+
it 'can be set from merging another hash' do
|
34
34
|
subject.merge!(:schema_dump => true)
|
35
|
-
subject.schema_dump.
|
35
|
+
expect(subject.schema_dump).to be_true
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
context
|
40
|
-
let(:environment) {
|
41
|
-
it
|
42
|
-
subject.schema_dump.
|
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
|
44
|
+
it 'can be assigned' do
|
45
45
|
subject.schema_dump = true
|
46
|
-
subject.schema_dump.
|
46
|
+
expect(subject.schema_dump).to be_true
|
47
47
|
end
|
48
|
-
it
|
48
|
+
it 'can be set from merging another hash' do
|
49
49
|
subject.merge!(:schema_dump => true)
|
50
|
-
subject.schema_dump.
|
50
|
+
expect(subject.schema_dump).to be_true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
context
|
55
|
-
let(:environment) {
|
56
|
-
it
|
57
|
-
subject.schema_dump.
|
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
|
59
|
+
it 'can be assigned' do
|
60
60
|
subject.schema_dump = false
|
61
|
-
subject.schema_dump.
|
61
|
+
expect(subject.schema_dump).to be_false
|
62
62
|
end
|
63
|
-
it
|
63
|
+
it 'can be set from merging another hash' do
|
64
64
|
subject.merge!(:schema_dump => false)
|
65
|
-
subject.schema_dump.
|
65
|
+
expect(subject.schema_dump).to be_false
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
describe
|
71
|
-
subject{ described_class.new }
|
70
|
+
describe '#load_database_tasks' do
|
71
|
+
subject { described_class.new }
|
72
72
|
|
73
|
-
it
|
74
|
-
subject.load_database_tasks.
|
73
|
+
it 'defaults to true' do
|
74
|
+
expect(subject.load_database_tasks).to be_true
|
75
75
|
end
|
76
|
-
it
|
76
|
+
it 'can be assigned' do
|
77
77
|
subject.load_database_tasks = false
|
78
|
-
subject.load_database_tasks.
|
78
|
+
expect(subject.load_database_tasks).to be_false
|
79
79
|
end
|
80
|
-
it
|
80
|
+
it 'can be set from merging another hash' do
|
81
81
|
subject.merge!(:load_database_tasks => false)
|
82
|
-
subject.load_database_tasks.
|
82
|
+
expect(subject.load_database_tasks).to be_false
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
describe
|
86
|
+
describe '#connect' do
|
87
87
|
let(:environments) do
|
88
88
|
{
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
'remote' => {
|
104
|
+
'adapter' => 'mysql',
|
105
|
+
'host' => '10.0.0.1',
|
106
|
+
'database' => 'sequel_rails_test_storage_remote',
|
107
107
|
},
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
'production' => {
|
109
|
+
'host' => '10.0.0.1',
|
110
|
+
'database' => 'sequel_rails_test_storage_production',
|
111
111
|
},
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
124
|
+
before { allow(SequelRails).to receive(:jruby?).and_return(is_jruby) }
|
151
125
|
|
152
|
-
shared_examples
|
153
|
-
context
|
154
|
-
let(:
|
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][
|
157
|
-
subject.
|
130
|
+
environments[environment]['max_connections'] = 7
|
131
|
+
subject.max_connections = max_connections
|
158
132
|
end
|
159
133
|
|
160
|
-
it
|
161
|
-
::Sequel.
|
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['
|
137
|
+
expect(hash_or_url['max_connections']).to eq(max_connections)
|
164
138
|
else
|
165
|
-
hash_or_url.
|
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
|
-
|
174
|
-
|
175
|
-
context "in C-Ruby" do
|
147
|
+
context 'for a postgres connection' do
|
176
148
|
|
177
|
-
|
178
|
-
|
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
|
-
|
181
|
-
|
182
|
-
|
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
|
-
|
170
|
+
let(:environment) { 'development' }
|
188
171
|
|
189
|
-
|
172
|
+
context 'in C-Ruby' do
|
190
173
|
|
191
|
-
|
192
|
-
|
174
|
+
include_examples 'max_connections'
|
175
|
+
include_examples 'search_path'
|
193
176
|
|
194
|
-
|
177
|
+
let(:is_jruby) { false }
|
195
178
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
-
|
185
|
+
|
203
186
|
end
|
204
187
|
|
205
|
-
context
|
188
|
+
context 'in JRuby' do
|
206
189
|
|
207
|
-
|
190
|
+
include_examples 'max_connections'
|
191
|
+
include_examples 'search_path'
|
208
192
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
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
|
-
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
context "for a mysql connection" do
|
204
|
+
context 'when url is already given' do
|
222
205
|
|
223
|
-
|
206
|
+
let(:environment) { 'url_already_constructed' }
|
224
207
|
|
225
|
-
|
226
|
-
|
227
|
-
|
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
|
220
|
+
context 'for a mysql connection' do
|
221
|
+
|
222
|
+
let(:environment) { 'remote' }
|
223
|
+
|
224
|
+
context 'in C-Ruby' do
|
238
225
|
|
239
|
-
|
226
|
+
include_examples 'max_connections'
|
240
227
|
|
241
|
-
|
228
|
+
let(:is_jruby) { false }
|
242
229
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
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
|
238
|
+
context 'in JRuby' do
|
239
|
+
|
240
|
+
include_examples 'max_connections'
|
253
241
|
|
254
|
-
let(:
|
242
|
+
let(:is_jruby) { true }
|
255
243
|
|
256
|
-
it
|
257
|
-
::Sequel.
|
258
|
-
url.
|
259
|
-
hash['adapter'].
|
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
|
269
|
+
describe 'after connect hook' do
|
269
270
|
let(:hook) { double }
|
270
|
-
let(:environment) {
|
271
|
-
before { SequelRails.unstub :jruby? }
|
271
|
+
let(:environment) { 'development' }
|
272
272
|
|
273
|
-
it
|
273
|
+
it 'runs hook if provided' do
|
274
274
|
subject.after_connect = hook
|
275
|
-
hook.
|
275
|
+
expect(hook).to receive(:call)
|
276
276
|
subject.connect environment
|
277
277
|
end
|
278
278
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
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
|
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
|
2
|
-
require
|
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) {
|
10
|
-
context
|
9
|
+
let(:result) { double(:result) }
|
10
|
+
context 'with no version specified' do
|
11
11
|
let(:opts) { {} }
|
12
|
-
it
|
13
|
-
::Sequel::Migrator.
|
14
|
-
db, Rails.root.join(
|
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).
|
16
|
+
expect(described_class.send(migration_method)).to be(result)
|
17
17
|
end
|
18
18
|
end
|
19
|
-
context
|
20
|
-
let(:opts) { {:target => 1} }
|
21
|
-
it
|
22
|
-
::Sequel::Migrator.
|
23
|
-
db, Rails.root.join(
|
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).
|
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
|
31
|
+
describe '.pending_migrations?' do
|
32
32
|
include FakeFS::SpecHelpers
|
33
|
-
let(:path) { Rails.root.join(
|
33
|
+
let(:path) { Rails.root.join('db/migrate') }
|
34
34
|
|
35
|
-
it
|
36
|
-
described_class.
|
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
|
39
|
+
it 'returns false if db/migrate directory exists, but is empty' do
|
40
40
|
FileUtils.mkdir_p path
|
41
|
-
described_class.pending_migrations
|
41
|
+
expect(described_class.pending_migrations?).to be_false
|
42
42
|
end
|
43
43
|
|
44
|
-
context
|
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
|
51
|
-
::Sequel::Migrator.
|
52
|
-
db, Rails.root.join(
|
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.
|
54
|
+
expect(described_class).to be_pending_migrations
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
58
|
-
::Sequel::Migrator.
|
59
|
-
db, Rails.root.join(
|
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.
|
61
|
+
expect(described_class).to_not be_pending_migrations
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|