dump 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +9 -9
  2. data/.travis.yml +9 -6
  3. data/Gemfile +5 -1
  4. data/LICENSE.txt +1 -1
  5. data/README.markdown +7 -5
  6. data/dump.gemspec +2 -2
  7. data/lib/dump_rake/dump_reader.rb +2 -0
  8. data/spec/.tmignore +1 -0
  9. data/spec/cycle_spec.rb +22 -16
  10. data/spec/dummy-4.1/.gitignore +16 -0
  11. data/spec/dummy-4.1/config.ru +4 -0
  12. data/spec/dummy-4.1/config/application.rb +30 -0
  13. data/spec/dummy-4.1/config/boot.rb +4 -0
  14. data/spec/dummy-4.1/config/database.yml +25 -0
  15. data/spec/dummy-4.1/config/environment.rb +5 -0
  16. data/spec/dummy-4.1/config/environments/development.rb +28 -0
  17. data/spec/dummy-4.1/config/environments/production.rb +67 -0
  18. data/spec/dummy-4.1/config/environments/test.rb +39 -0
  19. data/spec/dummy-4.1/config/initializers/backtrace_silencers.rb +7 -0
  20. data/spec/dummy-4.1/config/initializers/cookies_serializer.rb +3 -0
  21. data/spec/dummy-4.1/config/initializers/filter_parameter_logging.rb +4 -0
  22. data/spec/dummy-4.1/config/initializers/inflections.rb +16 -0
  23. data/spec/dummy-4.1/config/initializers/mime_types.rb +4 -0
  24. data/spec/dummy-4.1/config/initializers/session_store.rb +3 -0
  25. data/spec/dummy-4.1/config/initializers/wrap_parameters.rb +14 -0
  26. data/spec/dummy-4.1/config/locales/en.yml +23 -0
  27. data/spec/dummy-4.1/config/routes.rb +56 -0
  28. data/spec/dummy-4.1/config/secrets.yml +22 -0
  29. data/spec/dummy-4.1/db/seeds.rb +7 -0
  30. data/spec/dummy-4.1/log/.keep +0 -0
  31. data/spec/lib/dump_rake/dump_reader_spec.rb +223 -181
  32. data/spec/lib/dump_rake/dump_spec.rb +78 -78
  33. data/spec/lib/dump_rake/dump_writer_spec.rb +110 -110
  34. data/spec/lib/dump_rake/env/filter_spec.rb +24 -24
  35. data/spec/lib/dump_rake/env_spec.rb +33 -33
  36. data/spec/lib/dump_rake/rails_root_spec.rb +6 -6
  37. data/spec/lib/dump_rake/table_manipulation_spec.rb +60 -60
  38. data/spec/lib/dump_rake_spec.rb +93 -93
  39. data/spec/recipes/dump_spec.rb +128 -128
  40. data/spec/tasks/assets_spec.rb +18 -18
  41. data/spec/tasks/dump_spec.rb +9 -9
  42. metadata +49 -7
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy-4_1_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,56 @@
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 97498ce7962ef78b51283c750ba56fbb1bc7895b8e201b098c67c10954832ad9e4f18943edade5757ed4e47f693bbc0ceb2e3dc71df9f2973a20a3bcf4120b67
15
+
16
+ test:
17
+ secret_key_base: 5460be29a409fb920786367be99a3c8837e1c08c2e4ad4e535fcec4b0cfdf8771658f7fa1ee3a37205bc85a12efd51a85b945a12694d76a4d303092d51359e00
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
@@ -23,22 +23,22 @@ describe DumpReader do
23
23
  describe "restore" do
24
24
  it "should create selves instance and open" do
25
25
  @dump = double('dump')
26
- @dump.should_receive(:open)
27
- DumpReader.should_receive(:new).with('/abc/123.tmp').and_return(@dump)
26
+ expect(@dump).to receive(:open)
27
+ expect(DumpReader).to receive(:new).with('/abc/123.tmp').and_return(@dump)
28
28
  DumpReader.restore('/abc/123.tmp')
29
29
  end
30
30
 
31
31
  it "should call dump subroutines" do
32
32
  @dump = double('dump')
33
- @dump.stub(:open).and_yield(@dump)
34
- @dump.stub(:silence).and_yield
35
- DumpReader.stub(:new).and_return(@dump)
33
+ allow(@dump).to receive(:open).and_yield(@dump)
34
+ allow(@dump).to receive(:silence).and_yield
35
+ allow(DumpReader).to receive(:new).and_return(@dump)
36
36
 
37
- @dump.should_receive(:read_config).ordered
38
- @dump.should_receive(:migrate_down).ordered
39
- @dump.should_receive(:read_schema).ordered
40
- @dump.should_receive(:read_tables).ordered
41
- @dump.should_receive(:read_assets).ordered
37
+ expect(@dump).to receive(:read_config).ordered
38
+ expect(@dump).to receive(:migrate_down).ordered
39
+ expect(@dump).to receive(:read_schema).ordered
40
+ expect(@dump).to receive(:read_tables).ordered
41
+ expect(@dump).to receive(:read_assets).ordered
42
42
 
43
43
  DumpReader.restore('/abc/123.tmp')
44
44
  end
@@ -70,20 +70,20 @@ describe DumpReader do
70
70
  qqq: 123
71
71
  www: 345
72
72
  TEXT
73
- "#{@summary}".should == output.gsub(/#{output[/^\s+/]}/, ' ')
73
+ expect("#{@summary}").to eq(output.gsub(/#{output[/^\s+/]}/, ' '))
74
74
  end
75
75
 
76
76
  it "should pluralize" do
77
- Summary.pluralize(0, 'file').should == '0 files'
78
- Summary.pluralize(1, 'file').should == '1 file'
79
- Summary.pluralize(10, 'file').should == '10 files'
77
+ expect(Summary.pluralize(0, 'file')).to eq('0 files')
78
+ expect(Summary.pluralize(1, 'file')).to eq('1 file')
79
+ expect(Summary.pluralize(10, 'file')).to eq('10 files')
80
80
  end
81
81
  end
82
82
 
83
83
  it "should create selves instance and open" do
84
84
  @dump = double('dump')
85
- @dump.should_receive(:open)
86
- DumpReader.should_receive(:new).with('/abc/123.tmp').and_return(@dump)
85
+ expect(@dump).to receive(:open)
86
+ expect(DumpReader).to receive(:new).with('/abc/123.tmp').and_return(@dump)
87
87
  DumpReader.summary('/abc/123.tmp')
88
88
  end
89
89
 
@@ -97,19 +97,19 @@ describe DumpReader do
97
97
  formatted_tables = ['a: 10 rows', 'b: 20 rows', 'c: 666 rows']
98
98
 
99
99
  @dump = double('dump')
100
- @dump.stub(:config).and_return(:tables => tables, :assets => assets)
101
- @dump.stub(:open).and_yield(@dump)
102
- DumpReader.stub(:new).and_return(@dump)
103
- @dump.should_receive(:read_config)
100
+ allow(@dump).to receive(:config).and_return(:tables => tables, :assets => assets)
101
+ allow(@dump).to receive(:open).and_yield(@dump)
102
+ allow(DumpReader).to receive(:new).and_return(@dump)
103
+ expect(@dump).to receive(:read_config)
104
104
 
105
105
  @summary = double('summary')
106
- @summary.should_receive(:header).with('Tables')
107
- @summary.should_receive(:data).with(formatted_tables)
108
- @summary.should_receive(:header).with('Assets')
109
- @summary.should_receive(:data).with(formatted_assets)
110
- Summary.stub(:new).and_return(@summary)
106
+ expect(@summary).to receive(:header).with('Tables')
107
+ expect(@summary).to receive(:data).with(formatted_tables)
108
+ expect(@summary).to receive(:header).with('Assets')
109
+ expect(@summary).to receive(:data).with(formatted_assets)
110
+ allow(Summary).to receive(:new).and_return(@summary)
111
111
 
112
- DumpReader.summary('/abc/123.tmp').should == @summary
112
+ expect(DumpReader.summary('/abc/123.tmp')).to eq(@summary)
113
113
  end
114
114
  end
115
115
 
@@ -120,25 +120,25 @@ describe DumpReader do
120
120
 
121
121
  schema = double('schema')
122
122
  schema_lines = double('schema_lines')
123
- schema.should_receive(:split).with("\n").and_return(schema_lines)
123
+ expect(schema).to receive(:split).with("\n").and_return(schema_lines)
124
124
 
125
125
  @dump = double('dump')
126
- @dump.stub(:config).and_return(:tables => tables, :assets => assets)
127
- @dump.stub(:open).and_yield(@dump)
128
- @dump.stub(:schema).and_return(schema)
129
- DumpReader.stub(:new).and_return(@dump)
130
- @dump.should_receive(:read_config)
126
+ allow(@dump).to receive(:config).and_return(:tables => tables, :assets => assets)
127
+ allow(@dump).to receive(:open).and_yield(@dump)
128
+ allow(@dump).to receive(:schema).and_return(schema)
129
+ allow(DumpReader).to receive(:new).and_return(@dump)
130
+ expect(@dump).to receive(:read_config)
131
131
 
132
132
  @summary = double('summary')
133
- @summary.should_receive(:header).with('Tables')
134
- @summary.should_receive(:data).with(formatted_tables)
135
- @summary.should_receive(:header).with('Assets')
136
- @summary.should_receive(:data).with(formatted_assets)
137
- @summary.should_receive(:header).with('Schema')
138
- @summary.should_receive(:data).with(schema_lines)
139
- Summary.stub(:new).and_return(@summary)
140
-
141
- DumpReader.summary('/abc/123.tmp', :schema => true).should == @summary
133
+ expect(@summary).to receive(:header).with('Tables')
134
+ expect(@summary).to receive(:data).with(formatted_tables)
135
+ expect(@summary).to receive(:header).with('Assets')
136
+ expect(@summary).to receive(:data).with(formatted_assets)
137
+ expect(@summary).to receive(:header).with('Schema')
138
+ expect(@summary).to receive(:data).with(schema_lines)
139
+ allow(Summary).to receive(:new).and_return(@summary)
140
+
141
+ expect(DumpReader.summary('/abc/123.tmp', :schema => true)).to eq(@summary)
142
142
  end
143
143
  end
144
144
 
@@ -146,13 +146,13 @@ describe DumpReader do
146
146
  it "should set stream to gzipped tar reader" do
147
147
  @gzip = double('gzip')
148
148
  @stream = double('stream')
149
- Zlib::GzipReader.should_receive(:open).with(Pathname("123.tgz")).and_yield(@gzip)
150
- Archive::Tar::Minitar::Input.should_receive(:open).with(@gzip).and_yield(@stream)
149
+ expect(Zlib::GzipReader).to receive(:open).with(Pathname("123.tgz")).and_yield(@gzip)
150
+ expect(Archive::Tar::Minitar::Input).to receive(:open).with(@gzip).and_yield(@stream)
151
151
 
152
152
  @dump = DumpReader.new('123.tgz')
153
153
  @dump.open do |dump|
154
- dump.should == @dump
155
- dump.stream.should == @stream
154
+ expect(dump).to eq(@dump)
155
+ expect(dump.stream).to eq(@stream)
156
156
  end
157
157
  end
158
158
  end
@@ -164,60 +164,60 @@ describe DumpReader do
164
164
  @e3 = double('e3', :full_name => 'second.dump', :read => 'second.dump_data')
165
165
  @stream = [@e1, @e2, @e3]
166
166
  @dump = DumpReader.new('123.tgz')
167
- @dump.stub(:stream).and_return(@stream)
167
+ allow(@dump).to receive(:stream).and_return(@stream)
168
168
  end
169
169
 
170
170
  describe "find_entry" do
171
171
  it "should find first entry in stream equal string" do
172
172
  @dump.find_entry('config') do |entry|
173
- entry.should == @e1
173
+ expect(entry).to eq(@e1)
174
174
  end
175
175
  end
176
176
 
177
177
  it "should find first entry in stream matching regexp" do
178
178
  @dump.find_entry(/\.dump$/) do |entry|
179
- entry.should == @e2
179
+ expect(entry).to eq(@e2)
180
180
  end
181
181
  end
182
182
 
183
183
  it "should return result of block" do
184
- @dump.find_entry(/\.dump$/) do |entry|
184
+ expect(@dump.find_entry(/\.dump$/) do |entry|
185
185
  'hello'
186
- end.should == 'hello'
186
+ end).to eq('hello')
187
187
  end
188
188
  end
189
189
 
190
190
  describe "read_entry" do
191
191
  it "should call find_entry" do
192
- @dump.should_receive(:find_entry).with('config').and_yield(@e1)
192
+ expect(@dump).to receive(:find_entry).with('config').and_yield(@e1)
193
193
  @dump.read_entry('config')
194
194
  end
195
195
 
196
196
  it "should read entries data" do
197
- @dump.read_entry('config').should == 'config_data'
197
+ expect(@dump.read_entry('config')).to eq('config_data')
198
198
  end
199
199
  end
200
200
 
201
201
  describe "read_entry_to_file" do
202
202
  it "should call find_entry" do
203
- @dump.should_receive(:find_entry).with('config')
203
+ expect(@dump).to receive(:find_entry).with('config')
204
204
  @dump.read_entry_to_file('config')
205
205
  end
206
206
 
207
207
  it "should open temp file, write data there, rewind and yield that file" do
208
208
  @entry = double('entry')
209
- @dump.stub(:find_entry).and_yield(@entry)
209
+ allow(@dump).to receive(:find_entry).and_yield(@entry)
210
210
  @temp = double('temp')
211
- Tempfile.should_receive(:open).and_yield(@temp)
211
+ expect(Tempfile).to receive(:open).and_yield(@temp)
212
212
 
213
- @entry.should_receive(:eof?).and_return(false, false, true)
214
- @entry.should_receive(:read).with(4096).and_return('a' * 4096, 'b' * 1000)
215
- @temp.should_receive(:write).with('a' * 4096).ordered
216
- @temp.should_receive(:write).with('b' * 1000).ordered
217
- @temp.should_receive(:rewind).ordered
213
+ expect(@entry).to receive(:eof?).and_return(false, false, true)
214
+ expect(@entry).to receive(:read).with(4096).and_return('a' * 4096, 'b' * 1000)
215
+ expect(@temp).to receive(:write).with('a' * 4096).ordered
216
+ expect(@temp).to receive(:write).with('b' * 1000).ordered
217
+ expect(@temp).to receive(:rewind).ordered
218
218
 
219
219
  @dump.read_entry_to_file('config') do |f|
220
- f.should == @temp
220
+ expect(f).to eq(@temp)
221
221
  end
222
222
  end
223
223
  end
@@ -227,24 +227,24 @@ describe DumpReader do
227
227
  before do
228
228
  @stream = double('stream')
229
229
  @dump = DumpReader.new('123.tgz')
230
- @dump.stub(:stream).and_return(@stream)
231
- Progress.stub(:io).and_return(StringIO.new)
230
+ allow(@dump).to receive(:stream).and_return(@stream)
231
+ allow(Progress).to receive(:io).and_return(StringIO.new)
232
232
  end
233
233
 
234
234
  describe "read_config" do
235
235
  it "should read config" do
236
236
  @data = {:tables => {:first => 1}, :assets => %w[images videos]}
237
- @dump.should_receive(:read_entry).with('config').and_return(Marshal.dump(@data))
237
+ expect(@dump).to receive(:read_entry).with('config').and_return(Marshal.dump(@data))
238
238
 
239
239
  @dump.read_config
240
- @dump.config.should == @data
240
+ expect(@dump.config).to eq(@data)
241
241
  end
242
242
  end
243
243
 
244
244
  describe "migrate_down" do
245
245
  it "should not invoke rake tasks or find_entry if migrate_down is 0, no or false" do
246
- Rake::Task.should_not_receive(:[])
247
- @dump.should_not_receive(:find_entry)
246
+ expect(Rake::Task).not_to receive(:[])
247
+ expect(@dump).not_to receive(:find_entry)
248
248
 
249
249
  DumpRake::Env.with_env(:migrate_down => '0') do
250
250
  @dump.migrate_down
@@ -260,10 +260,10 @@ describe DumpReader do
260
260
  it "should invoke db:drop and db:create if migrate_down is reset" do
261
261
  @load_task = double('drop_task')
262
262
  @dump_task = double('create_task')
263
- Rake::Task.should_receive(:[]).with('db:drop').and_return(@load_task)
264
- Rake::Task.should_receive(:[]).with('db:create').and_return(@dump_task)
265
- @load_task.should_receive(:invoke)
266
- @dump_task.should_receive(:invoke)
263
+ expect(Rake::Task).to receive(:[]).with('db:drop').and_return(@load_task)
264
+ expect(Rake::Task).to receive(:[]).with('db:create').and_return(@dump_task)
265
+ expect(@load_task).to receive(:invoke)
266
+ expect(@dump_task).to receive(:invoke)
267
267
 
268
268
  DumpRake::Env.with_env(:migrate_down => 'reset') do
269
269
  @dump.migrate_down
@@ -273,8 +273,8 @@ describe DumpReader do
273
273
  [nil, '1'].each do |migrate_down_value|
274
274
  describe "when migrate_down is #{migrate_down_value.inspect}" do
275
275
  it "should not find_entry if table schema_migrations is not present" do
276
- @dump.stub(:avaliable_tables).and_return(%w[first])
277
- @dump.should_not_receive(:find_entry)
276
+ allow(@dump).to receive(:avaliable_tables).and_return(%w[first])
277
+ expect(@dump).not_to receive(:find_entry)
278
278
 
279
279
  DumpRake::Env.with_env(:migrate_down => migrate_down_value) do
280
280
  @dump.migrate_down
@@ -282,8 +282,8 @@ describe DumpReader do
282
282
  end
283
283
 
284
284
  it "should find schema_migrations.dump if table schema_migrations is present" do
285
- @dump.stub(:avaliable_tables).and_return(%w[schema_migrations first])
286
- @dump.should_receive(:find_entry).with('schema_migrations.dump')
285
+ allow(@dump).to receive(:avaliable_tables).and_return(%w[schema_migrations first])
286
+ expect(@dump).to receive(:find_entry).with('schema_migrations.dump')
287
287
 
288
288
  DumpRake::Env.with_env(:migrate_down => migrate_down_value) do
289
289
  @dump.migrate_down
@@ -298,29 +298,29 @@ describe DumpReader do
298
298
  end
299
299
  @entry.rewind
300
300
 
301
- @dump.stub(:avaliable_tables).and_return(%w[schema_migrations first])
302
- @dump.should_receive(:find_entry).with('schema_migrations.dump').and_yield(@entry)
303
- @dump.should_receive('table_rows').with('schema_migrations').and_return(%w[1 2 4 5 6 7].map{ |version| {'version' => version} })
301
+ allow(@dump).to receive(:avaliable_tables).and_return(%w[schema_migrations first])
302
+ expect(@dump).to receive(:find_entry).with('schema_migrations.dump').and_yield(@entry)
303
+ expect(@dump).to receive('table_rows').with('schema_migrations').and_return(%w[1 2 4 5 6 7].map{ |version| {'version' => version} })
304
304
 
305
305
  @versions = []
306
306
  @migrate_down_task = double('migrate_down_task')
307
- @migrate_down_task.should_receive('invoke').exactly(2).times.with do
307
+ expect(@migrate_down_task).to receive('invoke').exactly(3).times do
308
308
  version = DumpRake::Env['VERSION']
309
309
  @versions << version
310
310
  if version == '6'
311
311
  raise ActiveRecord::IrreversibleMigration
312
312
  end
313
313
  end
314
- @migrate_down_task.should_receive('reenable').exactly(3).times
314
+ expect(@migrate_down_task).to receive('reenable').exactly(3).times
315
315
 
316
- $stderr.should_receive('puts').with("Irreversible migration: 6")
316
+ expect($stderr).to receive('puts').with("Irreversible migration: 6")
317
317
 
318
- Rake::Task.should_receive(:[]).with('db:migrate:down').exactly(3).times.and_return(@migrate_down_task)
318
+ expect(Rake::Task).to receive(:[]).with('db:migrate:down').exactly(3).times.and_return(@migrate_down_task)
319
319
 
320
320
  DumpRake::Env.with_env(:migrate_down => migrate_down_value) do
321
321
  @dump.migrate_down
322
322
  end
323
- @versions.should == %w[5 6 7].reverse
323
+ expect(@versions).to eq(%w[5 6 7].reverse)
324
324
  end
325
325
  end
326
326
  end
@@ -329,33 +329,33 @@ describe DumpReader do
329
329
  describe "read_schema" do
330
330
  before do
331
331
  @task = double('task')
332
- Rake::Task.stub(:[]).and_return(@task)
333
- @task.stub(:invoke)
332
+ allow(Rake::Task).to receive(:[]).and_return(@task)
333
+ allow(@task).to receive(:invoke)
334
334
  end
335
335
 
336
336
  it "should read schema.rb to temp file" do
337
- @dump.should_receive(:read_entry_to_file).with('schema.rb')
337
+ expect(@dump).to receive(:read_entry_to_file).with('schema.rb')
338
338
  @dump.read_schema
339
339
  end
340
340
 
341
341
  it "should set ENV SCHEMA to temp files path" do
342
342
  @file = double('tempfile', :path => '/temp/123-arst')
343
- @dump.stub(:read_entry_to_file).and_yield(@file)
343
+ allow(@dump).to receive(:read_entry_to_file).and_yield(@file)
344
344
 
345
- DumpRake::Env.should_receive(:with_env).with('SCHEMA' => '/temp/123-arst')
345
+ expect(DumpRake::Env).to receive(:with_env).with('SCHEMA' => '/temp/123-arst')
346
346
  @dump.read_schema
347
347
  end
348
348
 
349
349
  it "should call task db:schema:load and db:schema:dump" do
350
350
  @file = double('tempfile', :path => '/temp/123-arst')
351
- @dump.stub(:read_entry_to_file).and_yield(@file)
351
+ allow(@dump).to receive(:read_entry_to_file).and_yield(@file)
352
352
 
353
353
  @load_task = double('load_task')
354
354
  @dump_task = double('dump_task')
355
- Rake::Task.should_receive(:[]).with('db:schema:load').and_return(@load_task)
356
- Rake::Task.should_receive(:[]).with('db:schema:dump').and_return(@dump_task)
357
- @load_task.should_receive(:invoke)
358
- @dump_task.should_receive(:invoke)
355
+ expect(Rake::Task).to receive(:[]).with('db:schema:load').and_return(@load_task)
356
+ expect(Rake::Task).to receive(:[]).with('db:schema:dump').and_return(@dump_task)
357
+ expect(@load_task).to receive(:invoke)
358
+ expect(@dump_task).to receive(:invoke)
359
359
 
360
360
  @dump.read_schema
361
361
  end
@@ -364,51 +364,76 @@ describe DumpReader do
364
364
  describe "schema" do
365
365
  it "should read schema" do
366
366
  @data = %q{create table, rows, etc...}
367
- @dump.should_receive(:read_entry).with('schema.rb').and_return(@data)
368
- @dump.schema.should == @data
367
+ expect(@dump).to receive(:read_entry).with('schema.rb').and_return(@data)
368
+ expect(@dump.schema).to eq(@data)
369
369
  end
370
370
  end
371
371
 
372
372
  describe "read_tables" do
373
373
  it "should verify connection" do
374
- @dump.stub(:config).and_return({:tables => []})
375
- @dump.should_receive(:verify_connection)
374
+ allow(@dump).to receive(:config).and_return({:tables => []})
375
+ expect(@dump).to receive(:verify_connection)
376
376
  @dump.read_tables
377
377
  end
378
378
 
379
379
  it "should call read_table for each table in config" do
380
- @dump.stub(:verify_connection)
381
- @dump.stub(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
380
+ allow(@dump).to receive(:verify_connection)
381
+ allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
382
382
 
383
- @dump.should_receive(:read_table).with('first', 1)
384
- @dump.should_receive(:read_table).with('second', 3)
383
+ expect(@dump).to receive(:read_table).with('first', 1)
384
+ expect(@dump).to receive(:read_table).with('second', 3)
385
385
 
386
386
  @dump.read_tables
387
387
  end
388
+
389
+ describe "when called with restore_tables" do
390
+ it "should verify connection and call read_table for each table in restore_tables" do
391
+ allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
392
+
393
+ expect(@dump).to receive(:verify_connection)
394
+ expect(@dump).to receive(:read_table).with('first', 1)
395
+ expect(@dump).not_to receive(:read_table).with('second', 3)
396
+
397
+ DumpRake::Env.with_env(:restore_tables => 'first') do
398
+ @dump.read_tables
399
+ end
400
+ end
401
+
402
+ it "should not verfiy connection or call read_table for empty restore_tables" do
403
+ allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
404
+
405
+ expect(@dump).not_to receive(:verify_connection)
406
+ expect(@dump).not_to receive(:read_table)
407
+
408
+ DumpRake::Env.with_env(:restore_tables => '') do
409
+ @dump.read_tables
410
+ end
411
+ end
412
+ end
388
413
  end
389
414
 
390
415
  describe "read_table" do
391
416
  it "should not read table if no entry found for table" do
392
- @dump.should_receive(:find_entry).with('first.dump').and_return(nil)
393
- @dump.should_not_receive(:quote_table_name)
417
+ expect(@dump).to receive(:find_entry).with('first.dump').and_return(nil)
418
+ expect(@dump).not_to receive(:quote_table_name)
394
419
  @dump.read_table('first', 10)
395
420
  end
396
421
 
397
422
  it "should clear table and read table if entry found for table" do
398
423
  @entry = double('entry', :to_str => Marshal.dump('data'), :eof? => true)
399
- @dump.should_receive(:columns_insert_sql).with('data')
400
- @dump.should_receive(:find_entry).with('first.dump').and_yield(@entry)
401
- @dump.should_receive(:quote_table_name).with('first').and_return('`first`')
402
- @dump.should_receive(:clear_table).with('`first`')
424
+ expect(@dump).to receive(:columns_insert_sql).with('data')
425
+ expect(@dump).to receive(:find_entry).with('first.dump').and_yield(@entry)
426
+ expect(@dump).to receive(:quote_table_name).with('first').and_return('`first`')
427
+ expect(@dump).to receive(:clear_table).with('`first`')
403
428
  @dump.read_table('first', 10)
404
429
  end
405
430
 
406
431
  it "should clear schema table before writing" do
407
432
  @entry = double('entry', :to_str => Marshal.dump('data'), :eof? => true)
408
- @dump.should_receive(:columns_insert_sql).with('data')
409
- @dump.should_receive(:find_entry).with('schema_migrations.dump').and_yield(@entry)
410
- @dump.should_receive(:quote_table_name).with('schema_migrations').and_return('`schema_migrations`')
411
- @dump.should_receive(:clear_table).with('`schema_migrations`')
433
+ expect(@dump).to receive(:columns_insert_sql).with('data')
434
+ expect(@dump).to receive(:find_entry).with('schema_migrations.dump').and_yield(@entry)
435
+ expect(@dump).to receive(:quote_table_name).with('schema_migrations').and_return('`schema_migrations`')
436
+ expect(@dump).to receive(:clear_table).with('`schema_migrations`')
412
437
  @dump.read_table('schema_migrations', 10)
413
438
  end
414
439
 
@@ -426,43 +451,43 @@ describe DumpReader do
426
451
  end
427
452
  @entry.rewind
428
453
 
429
- @dump.stub(:find_entry).and_yield(@entry)
454
+ allow(@dump).to receive(:find_entry).and_yield(@entry)
430
455
  end
431
456
  it "should read to eof" do
432
457
  create_entry(2500)
433
- @dump.stub(:clear_table)
434
- @dump.stub(:insert_into_table)
458
+ allow(@dump).to receive(:clear_table)
459
+ allow(@dump).to receive(:insert_into_table)
435
460
  @dump.read_table('first', 2500)
436
- @entry.eof?.should be_true
461
+ expect(@entry.eof?).to be_truthy
437
462
  end
438
463
 
439
464
  it "should try to insert rows in slices of 1000 rows" do
440
465
  create_entry(2500)
441
- @dump.stub(:clear_table)
442
- @dump.should_receive(:insert_into_table).with(anything, anything, object_of_length(1000)).twice
443
- @dump.should_receive(:insert_into_table).with(anything, anything, object_of_length(500)).once
466
+ allow(@dump).to receive(:clear_table)
467
+ expect(@dump).to receive(:insert_into_table).with(anything, anything, object_of_length(1000)).twice
468
+ expect(@dump).to receive(:insert_into_table).with(anything, anything, object_of_length(500)).once
444
469
 
445
470
  @dump.read_table('first', 2500)
446
471
  end
447
472
 
448
473
  it "should try to insert row by row if slice method fails" do
449
474
  create_entry(2500)
450
- @dump.stub(:clear_table)
451
- @dump.should_receive(:insert_into_table).with(anything, anything, kind_of(Array)).exactly(3).times.and_raise('sql error')
452
- @dump.should_receive(:insert_into_table).with(anything, anything, kind_of(String)).exactly(2500).times
475
+ allow(@dump).to receive(:clear_table)
476
+ expect(@dump).to receive(:insert_into_table).with(anything, anything, kind_of(Array)).exactly(3).times.and_raise('sql error')
477
+ expect(@dump).to receive(:insert_into_table).with(anything, anything, kind_of(String)).exactly(2500).times
453
478
  @dump.read_table('first', 2500)
454
479
  end
455
480
 
456
481
  it "should quote table, columns and values and send them to insert_into_table" do
457
482
  create_entry(100)
458
- @dump.stub(:clear_table)
459
- @dump.should_receive(:quote_table_name).with('first').and_return('`first`')
460
- @dump.should_receive(:columns_insert_sql).with(@columns).and_return('(`id`, `name`)')
483
+ allow(@dump).to receive(:clear_table)
484
+ expect(@dump).to receive(:quote_table_name).with('first').and_return('`first`')
485
+ expect(@dump).to receive(:columns_insert_sql).with(@columns).and_return('(`id`, `name`)')
461
486
  @rows.each do |row|
462
- @dump.should_receive(:values_insert_sql).with(row).and_return{ |vs| vs.inspect }
487
+ expect(@dump).to receive(:values_insert_sql).with(row){ |vs| vs.inspect }
463
488
  end
464
489
 
465
- @dump.should_receive(:insert_into_table).with('`first`', '(`id`, `name`)', @rows.map(&:inspect))
490
+ expect(@dump).to receive(:insert_into_table).with('`first`', '(`id`, `name`)', @rows.map(&:inspect))
466
491
  @dump.read_table('first', 100)
467
492
  end
468
493
  end
@@ -471,45 +496,45 @@ describe DumpReader do
471
496
  describe "read_assets" do
472
497
  before do
473
498
  @task = double('task')
474
- Rake::Task.stub(:[]).with('assets:delete').and_return(@task)
475
- @task.stub(:invoke)
476
- @dump.stub(:assets_root_link).and_yield('/tmp', 'assets')
499
+ allow(Rake::Task).to receive(:[]).with('assets:delete').and_return(@task)
500
+ allow(@task).to receive(:invoke)
501
+ allow(@dump).to receive(:assets_root_link).and_yield('/tmp', 'assets')
477
502
  end
478
503
 
479
504
  it "should not read assets if config[:assets] is nil" do
480
- @dump.stub(:config).and_return({})
481
- @dump.should_not_receive(:find_entry)
505
+ allow(@dump).to receive(:config).and_return({})
506
+ expect(@dump).not_to receive(:find_entry)
482
507
  @dump.read_assets
483
508
  end
484
509
 
485
510
  it "should not read assets if config[:assets] is blank" do
486
- @dump.stub(:config).and_return({:assets => []})
487
- @dump.should_not_receive(:find_entry)
511
+ allow(@dump).to receive(:config).and_return({:assets => []})
512
+ expect(@dump).not_to receive(:find_entry)
488
513
  @dump.read_assets
489
514
  end
490
515
 
491
516
  describe "deleting existing assets" do
492
517
  before do
493
- @stream.stub(:each)
518
+ allow(@stream).to receive(:each)
494
519
  end
495
520
 
496
521
  it "should call assets:delete" do
497
522
  @assets = %w[images videos]
498
- @dump.stub(:config).and_return({:assets => @assets})
499
- @dump.stub(:find_entry)
523
+ allow(@dump).to receive(:config).and_return({:assets => @assets})
524
+ allow(@dump).to receive(:find_entry)
500
525
 
501
- @task.should_receive(:invoke)
526
+ expect(@task).to receive(:invoke)
502
527
 
503
528
  @dump.read_assets
504
529
  end
505
530
 
506
531
  it "should call assets:delete with ASSETS set to config[:assets] joined with :" do
507
532
  @assets = %w[images videos]
508
- @dump.stub(:config).and_return({:assets => @assets})
509
- @dump.stub(:find_entry)
533
+ allow(@dump).to receive(:config).and_return({:assets => @assets})
534
+ allow(@dump).to receive(:find_entry)
510
535
 
511
- def @task.invoke
512
- DumpRake::Env[:assets].should == 'images:videos'
536
+ expect(@task).to receive(:invoke) do
537
+ expect(DumpRake::Env[:assets]).to eq('images:videos')
513
538
  end
514
539
 
515
540
  @dump.read_assets
@@ -518,40 +543,57 @@ describe DumpReader do
518
543
  describe "when called with restore_assets" do
519
544
  it "should delete files and dirs only in requested paths" do
520
545
  @assets = %w[images videos]
521
- @dump.stub(:config).and_return({:assets => @assets})
546
+ allow(@dump).to receive(:config).and_return({:assets => @assets})
522
547
 
523
- DumpRake::Assets.should_receive('glob_asset_children').with('images', '**/*').and_return(%w[images images/a.jpg images/b.jpg])
524
- DumpRake::Assets.should_receive('glob_asset_children').with('videos', '**/*').and_return(%w[videos videos/a.mov])
548
+ expect(DumpRake::Assets).to receive('glob_asset_children').with('images', '**/*').and_return(%w[images images/a.jpg images/b.jpg])
549
+ expect(DumpRake::Assets).to receive('glob_asset_children').with('videos', '**/*').and_return(%w[videos videos/a.mov])
525
550
 
526
- @dump.should_receive('read_asset?').with('images/b.jpg', DumpRake::RailsRoot).ordered.and_return(false)
527
- @dump.should_receive('read_asset?').with('images/a.jpg', DumpRake::RailsRoot).ordered.and_return(true)
528
- @dump.should_receive('read_asset?').with('images', DumpRake::RailsRoot).ordered.and_return(true)
529
- @dump.should_receive('read_asset?').with('videos/a.mov', DumpRake::RailsRoot).ordered.and_return(false)
530
- @dump.should_receive('read_asset?').with('videos', DumpRake::RailsRoot).ordered.and_return(false)
551
+ expect(@dump).to receive('read_asset?').with('images/b.jpg', DumpRake::RailsRoot).ordered.and_return(false)
552
+ expect(@dump).to receive('read_asset?').with('images/a.jpg', DumpRake::RailsRoot).ordered.and_return(true)
553
+ expect(@dump).to receive('read_asset?').with('images', DumpRake::RailsRoot).ordered.and_return(true)
554
+ expect(@dump).to receive('read_asset?').with('videos/a.mov', DumpRake::RailsRoot).ordered.and_return(false)
555
+ expect(@dump).to receive('read_asset?').with('videos', DumpRake::RailsRoot).ordered.and_return(false)
531
556
 
532
- File.should_receive('file?').with('images/a.jpg').and_return(true)
533
- File.should_receive('unlink').with('images/a.jpg')
534
- File.should_not_receive('file?').with('images/b.jpg')
535
- File.should_receive('file?').with('images').and_return(false)
536
- File.should_receive('directory?').with('images').and_return(true)
537
- Dir.should_receive('unlink').with('images').and_raise(Errno::ENOTEMPTY)
557
+ expect(File).to receive('file?').with('images/a.jpg').and_return(true)
558
+ expect(File).to receive('unlink').with('images/a.jpg')
559
+ expect(File).not_to receive('file?').with('images/b.jpg')
560
+ expect(File).to receive('file?').with('images').and_return(false)
561
+ expect(File).to receive('directory?').with('images').and_return(true)
562
+ expect(Dir).to receive('unlink').with('images').and_raise(Errno::ENOTEMPTY)
538
563
 
539
564
  DumpRake::Env.with_env(:restore_assets => 'images/a.*:stylesheets') do
540
565
  @dump.read_assets
541
566
  end
542
567
  end
568
+
569
+ it "should not delete any files and dirs for empty list" do
570
+ @assets = %w[images videos]
571
+ allow(@dump).to receive(:config).and_return({:assets => @assets})
572
+
573
+ expect(DumpRake::Assets).not_to receive('glob_asset_children')
574
+
575
+ expect(@dump).not_to receive('read_asset?')
576
+
577
+ expect(File).not_to receive('directory?')
578
+ expect(File).not_to receive('file?')
579
+ expect(File).not_to receive('unlink')
580
+
581
+ DumpRake::Env.with_env(:restore_assets => '') do
582
+ @dump.read_assets
583
+ end
584
+ end
543
585
  end
544
586
  end
545
587
 
546
588
  describe "old style" do
547
589
  it "should find assets.tar" do
548
590
  @assets = %w[images videos]
549
- @dump.stub(:config).and_return({:assets => @assets})
550
- Dir.stub(:glob).and_return([])
551
- FileUtils.stub(:remove_entry)
552
- @stream.stub(:each)
591
+ allow(@dump).to receive(:config).and_return({:assets => @assets})
592
+ allow(Dir).to receive(:glob).and_return([])
593
+ allow(FileUtils).to receive(:remove_entry)
594
+ allow(@stream).to receive(:each)
553
595
 
554
- @dump.should_receive(:find_entry).with('assets.tar')
596
+ expect(@dump).to receive(:find_entry).with('assets.tar')
555
597
  @dump.read_assets
556
598
  end
557
599
 
@@ -561,23 +603,23 @@ describe DumpReader do
561
603
  {'images' => {:files => 0, :total => 0}, 'videos' => {:files => 0, :total => 0}},
562
604
  ].each do |assets|
563
605
  it "should rewrite rewind method to empty method - to not raise exception, open tar and extract each entry" do
564
- @dump.stub(:config).and_return({:assets => assets})
565
- Dir.stub(:glob).and_return([])
566
- FileUtils.stub(:remove_entry)
606
+ allow(@dump).to receive(:config).and_return({:assets => assets})
607
+ allow(Dir).to receive(:glob).and_return([])
608
+ allow(FileUtils).to receive(:remove_entry)
567
609
 
568
610
  @assets_tar = double('assets_tar')
569
- @assets_tar.stub(:rewind).and_raise('hehe - we want to rewind to center of gzip')
570
- @dump.stub(:find_entry).and_yield(@assets_tar)
611
+ allow(@assets_tar).to receive(:rewind).and_raise('hehe - we want to rewind to center of gzip')
612
+ allow(@dump).to receive(:find_entry).and_yield(@assets_tar)
571
613
 
572
614
  @inp = double('inp')
573
- each_excpectation = @inp.should_receive(:each)
615
+ each_excpectation = expect(@inp).to receive(:each)
574
616
  @entries = %w[a b c d].map do |s|
575
617
  file = double("file_#{s}")
576
618
  each_excpectation.and_yield(file)
577
- @inp.should_receive(:extract_entry).with(DumpRake::RailsRoot, file)
619
+ expect(@inp).to receive(:extract_entry).with(DumpRake::RailsRoot, file)
578
620
  file
579
621
  end
580
- Archive::Tar::Minitar.should_receive(:open).with(@assets_tar).and_yield(@inp)
622
+ expect(Archive::Tar::Minitar).to receive(:open).with(@assets_tar).and_yield(@inp)
581
623
 
582
624
  @dump.read_assets
583
625
  end
@@ -586,7 +628,7 @@ describe DumpReader do
586
628
 
587
629
  describe "new style" do
588
630
  before do
589
- @dump.should_receive(:find_entry).with('assets.tar')
631
+ expect(@dump).to receive(:find_entry).with('assets.tar')
590
632
  end
591
633
 
592
634
  [
@@ -595,21 +637,21 @@ describe DumpReader do
595
637
  {'images' => {:files => 0, :total => 0}, 'videos' => {:files => 0, :total => 0}},
596
638
  ].each do |assets|
597
639
  it "should extract each entry" do
598
- @dump.stub(:config).and_return({:assets => assets})
599
- Dir.stub(:glob).and_return([])
600
- FileUtils.stub(:remove_entry)
640
+ allow(@dump).to receive(:config).and_return({:assets => assets})
641
+ allow(Dir).to receive(:glob).and_return([])
642
+ allow(FileUtils).to receive(:remove_entry)
601
643
 
602
- @dump.should_receive(:assets_root_link).and_yield('/tmp/abc', 'assets')
603
- each_excpectation = @stream.should_receive(:each)
644
+ expect(@dump).to receive(:assets_root_link).and_yield('/tmp/abc', 'assets')
645
+ each_excpectation = expect(@stream).to receive(:each)
604
646
  @entries = %w[a b c d].map do |s|
605
647
  file = double("file_#{s}", :full_name => "assets/#{s}")
606
648
  each_excpectation.and_yield(file)
607
- @stream.should_receive(:extract_entry).with('/tmp/abc', file)
649
+ expect(@stream).to receive(:extract_entry).with('/tmp/abc', file)
608
650
  file
609
651
  end
610
652
  other_file = double('other_file', :full_name => 'other_file')
611
653
  each_excpectation.and_yield(other_file)
612
- @stream.should_not_receive(:extract_entry).with('/tmp/abc', other_file)
654
+ expect(@stream).not_to receive(:extract_entry).with('/tmp/abc', other_file)
613
655
 
614
656
  @dump.read_assets
615
657
  end
@@ -620,18 +662,18 @@ describe DumpReader do
620
662
  describe "read_asset?" do
621
663
  it "should create filter and call custom_pass? on it" do
622
664
  @filter = double('filter')
623
- @filter.stub('custom_pass?')
665
+ allow(@filter).to receive('custom_pass?')
624
666
 
625
- DumpRake::Env.should_receive('filter').with(:restore_assets, DumpRake::Assets::SPLITTER).and_return(@filter)
667
+ expect(DumpRake::Env).to receive('filter').with(:restore_assets, DumpRake::Assets::SPLITTER).and_return(@filter)
626
668
 
627
669
  @dump.read_asset?('a', 'b')
628
670
  end
629
671
 
630
672
  it "should test path usint fnmatch" do
631
673
  DumpRake::Env.with_env(:restore_assets => '[a-b]') do
632
- @dump.read_asset?('x/a', 'x').should be_true
633
- @dump.read_asset?('x/b/file', 'x').should be_true
634
- @dump.read_asset?('x/c', 'x').should be_false
674
+ expect(@dump.read_asset?('x/a', 'x')).to be_truthy
675
+ expect(@dump.read_asset?('x/b/file', 'x')).to be_truthy
676
+ expect(@dump.read_asset?('x/c', 'x')).to be_falsey
635
677
  end
636
678
  end
637
679
  end