fixation 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b9b89848ceefd67ecc8243402e8a739f088dc14
4
- data.tar.gz: 782f9e638b36c56c45e74e842795da2349386936
3
+ metadata.gz: 9030fd3deb6fe90db7f3386081d6f54022986bae
4
+ data.tar.gz: c4ee3f55efd5e72710339bed2ec9c2a35381372d
5
5
  SHA512:
6
- metadata.gz: 23a58a4aac7dcea633e894cdb79c01b830f24257e5a1ef3ef7cfc2180a5d185ac7ae93089a0bf6a3f57342beb709db07cb5f0bf0e821947ac81d641e6bab26cc
7
- data.tar.gz: 5b97553515160b6baaca85486a0322cd75e94320e358ee4de553d7df98170c1614839e1686f65168e8db58728935198d7524c28f62fbb1a2a2eb7a041c0c59f3
6
+ metadata.gz: bccd15f8df0a0562de2d1582c6a1fad9eb9aaea1465884c4878704ddb1ae4458ff985aeb8af745cbf70780b825be03529addef6ab172a80c5f5d5d37885e6b3d
7
+ data.tar.gz: 28532d1a859500bfba29ead7aa8a09053d90ef11699ac68609a0769b0bf89b9659b069755283718c89962ec9ca32602d15d46fb11a20668f278f382f4c4610be
data/README.md CHANGED
@@ -6,10 +6,12 @@ Like ActiveRecord's normal fixture implementation, Fixation will load the model
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ Add this gem to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'fixation'
12
+ groups :development, :test do
13
+ gem 'fixation'
14
+ end
13
15
  ```
14
16
 
15
17
  And then execute:
@@ -58,6 +60,23 @@ You'll need to run rake tasks like `db:create` and `db:test:prepare` the normal
58
60
  Not all features of regular ActiveRecord fixtures are supported:
59
61
  * HABTM support has not been implemented (does anyone use HABTM these days?)
60
62
 
63
+ ## Multiple fixture paths
64
+
65
+ Unlike regular ActiveRecord fixtures, Fixation supports looking for fixture files in multiple paths. It defaults to looking in `test/fixtures` and `spec/fixtures`. You can change this in your initializer before you do the spring setup:
66
+
67
+ ```ruby
68
+ if Rails.env.test?
69
+ Fixation.paths = %w(spec/fixtures db/seeds)
70
+ end
71
+
72
+ if Rails.env.test? && Fixation.running_under_spring?
73
+ Rails.application.config.after_initialize do
74
+ Fixation.preload_for_spring
75
+ end
76
+ end
77
+ ```
78
+
79
+
61
80
  ## Contributing
62
81
 
63
82
  Bug reports and pull requests are welcome on GitHub at https://github.com/willbryant/fixation.
@@ -102,7 +102,7 @@ module Fixation
102
102
  end
103
103
 
104
104
  nonexistant_columns.each do |column_name|
105
- association = reflection_class._reflections[column_name.to_sym]
105
+ association = reflection_class.reflect_on_association(column_name)
106
106
 
107
107
  if association.nil?
108
108
  raise ActiveRecord::Fixture::FormatError, "No column named #{column_name} found in table #{table_name}"
@@ -138,6 +138,7 @@ module Fixation
138
138
  columns_to_include = Set.new
139
139
  embellished_rows.each do |name, attributes|
140
140
  attributes.each do |column_name, value|
141
+ raise ActiveRecord::Fixture::FormatError, "No column named #{column_name.inspect} found in table #{table_name.inspect} (attribute on fixture #{name.inspect})" unless columns_hash[column_name]
141
142
  columns_to_include.add(columns_hash[column_name])
142
143
  end
143
144
  end
@@ -1,3 +1,3 @@
1
1
  module Fixation
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.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.2.0
4
+ version: 1.3.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-06 00:00:00.000000000 Z
11
+ date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler