fixation 1.1.1 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 658d4e159e9f4f2a40209757beeb8992e52099ad
4
- data.tar.gz: 445b6032756c033604a8683d583e2a3100122daf
3
+ metadata.gz: 7b9b89848ceefd67ecc8243402e8a739f088dc14
4
+ data.tar.gz: 782f9e638b36c56c45e74e842795da2349386936
5
5
  SHA512:
6
- metadata.gz: 3a553d7eb6c23791c74c68bab53d6541e4254052e08525d62c6c658c702a363ebe358d86b8757a1de7952b3051bd1348dab721fd6b07da0a5f4558239a5c0abe
7
- data.tar.gz: 5b858f89167561777658619076f3fb58c2dd87d91ee0a1ea247a1fb61b3a8fddc026a861ff3cc1d3ae151b2e3a49cf232a33bb650c6860c1448bf4d2cf59d74c
6
+ metadata.gz: 23a58a4aac7dcea633e894cdb79c01b830f24257e5a1ef3ef7cfc2180a5d185ac7ae93089a0bf6a3f57342beb709db07cb5f0bf0e821947ac81d641e6bab26cc
7
+ data.tar.gz: 5b97553515160b6baaca85486a0322cd75e94320e358ee4de553d7df98170c1614839e1686f65168e8db58728935198d7524c28f62fbb1a2a2eb7a041c0c59f3
data/README.md CHANGED
@@ -47,7 +47,7 @@ config.include Fixation.fixture_methods
47
47
 
48
48
  ## Usage
49
49
 
50
- Simply use run your tests under spring.
50
+ Simply run your tests under spring.
51
51
 
52
52
  bundle exec spring spec/models/my_spec.rb
53
53
 
@@ -192,9 +192,10 @@ module Fixation
192
192
 
193
193
  def compile_fixture_file(filename, basename, connection, now)
194
194
  fixture_table = FixtureTable.new(filename, basename, connection, now)
195
- @fixture_ids[fixture_table.table_name] = fixture_table.fixture_ids
196
- @statements[fixture_table.table_name] = fixture_table.statements
197
- @class_names[fixture_table.table_name] = fixture_table.class_name
195
+ fixture_name = basename.gsub('/', '_')
196
+ @fixture_ids[fixture_name] = fixture_table.fixture_ids
197
+ @statements[fixture_name] = fixture_table.statements
198
+ @class_names[fixture_name] = fixture_table.class_name
198
199
  end
199
200
 
200
201
  def apply_fixtures(connection = ActiveRecord::Base.connection)
@@ -227,30 +228,29 @@ module Fixation
227
228
  super
228
229
  end
229
230
 
230
- fixture_ids.each do |table_name, fixtures|
231
+ fixture_ids.each do |fixture_name, fixtures|
231
232
  begin
232
- klass = class_names[table_name].constantize
233
+ klass = class_names[fixture_name].constantize
233
234
  rescue NameError
234
235
  next
235
236
  end
236
237
 
237
- accessor_name = table_name
238
- define_method(accessor_name) do |*fixture_names|
238
+ define_method(fixture_name) do |*fixture_names|
239
239
  force_reload = fixture_names.pop if fixture_names.last == true || fixture_names.last == :reload
240
240
 
241
- @fixture_cache[table_name] ||= {}
241
+ @fixture_cache[fixture_name] ||= {}
242
242
 
243
243
  instances = fixture_names.map do |name|
244
244
  id = fixtures[name.to_s]
245
- raise StandardError, "No fixture named '#{name}' found for fixture set '#{table_name}'" if id.nil?
245
+ raise StandardError, "No fixture named '#{name}' found for fixture set '#{fixture_name}'" if id.nil?
246
246
 
247
- @fixture_cache[table_name].delete(name) if force_reload
248
- @fixture_cache[table_name][name] ||= klass.find(id)
247
+ @fixture_cache[fixture_name].delete(name) if force_reload
248
+ @fixture_cache[fixture_name][name] ||= klass.find(id)
249
249
  end
250
250
 
251
251
  instances.size == 1 ? instances.first : instances
252
252
  end
253
- private accessor_name
253
+ private fixture_name
254
254
  end
255
255
  end
256
256
  end
@@ -1,3 +1,3 @@
1
1
  module Fixation
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler