initial-test-data 0.6.0 → 0.6.1

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: 17e4ed2b4b7f72aa9b55839d7771a582dfb9dbc8
4
- data.tar.gz: 914fd4f5d95b6415a48bd4204531fc7b114449f6
3
+ metadata.gz: 05d95588e443768898d5547187d606fd796cf7f4
4
+ data.tar.gz: 6ca2346cdac11e3068d815e479a740edc72cbbce
5
5
  SHA512:
6
- metadata.gz: df868f6ca90b921fcd5796ed02e8e151f9a7b8d15c713e7f873d62c8f41976b68073c91b024480fb12f01b9ffa410768a49e50ae8e379fa214668b720c13ee37
7
- data.tar.gz: c2543a2efe311b5e727bbb8eafcd9b909789db9f2cac854d5523e7662e4ac8268b694d61effa3d334fa96694b830af2b3a7f47a6142080461529a21da56d569b
6
+ metadata.gz: e7d871df257a88d2aadea4eafe2323572cf660ba6c716a0b4b16f606dd647182a0f36ca225e46c7cce46c570e1a209406355380c8d8646573a096a7b64c60404
7
+ data.tar.gz: 94c78e1f4e73147a0858c3729461e3edadd503b61a3caf5bbb5cead92c1f7e720559998dc0666c76d761135f7cd4518b2192c37106d00c6762c3b5aca94b776a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG - initial-test-data
2
2
 
3
+ ## 0.6.1 (February 28, 2016)
4
+
5
+ * Users should require factory_girl patch explicitly.
6
+
3
7
  ## 0.6.0 (February 28, 2016)
4
8
 
5
9
  * Allow the Factory Girl to generate sequences correctly.
data/README.md CHANGED
@@ -41,7 +41,7 @@ Edit `test/test_helper.rb` like this:
41
41
  ENV['RAILS_ENV'] ||= 'test'
42
42
  require File.expand_path('../../config/environment', __FILE__)
43
43
  require 'rails/test_help'
44
- require 'initial-test-data'
44
+ require 'initial-test-data/factory_girl' # If you use the Factory Girl
45
45
 
46
46
  InitialTestData.import
47
47
 
@@ -64,7 +64,7 @@ ENV["RAILS_ENV"] ||= 'test'
64
64
  require 'spec_helper'
65
65
  require File.expand_path("../../config/environment", __FILE__)
66
66
  require 'rspec/rails'
67
- require 'initial-test-data'
67
+ require 'initial-test-data/factory_girl' # If you use the Factory Girl
68
68
 
69
69
  RSpec.configure do |config|
70
70
  config.include InitialTestData::Utilities
@@ -245,6 +245,37 @@ end
245
245
  ### RSpec, Capybara and Factory Girl
246
246
 
247
247
  ```ruby
248
+ # Gemfile
249
+
250
+ ...
251
+ group :test do
252
+ gem 'rspec-rails'
253
+ gem 'factory_girl_rails'
254
+ gem 'initial-test-data'
255
+ end
256
+ ...
257
+
258
+ # spec/rails_helper.rb
259
+
260
+ ENV["RAILS_ENV"] ||= 'test'
261
+ require 'spec_helper'
262
+ require File.expand_path("../../config/environment", __FILE__)
263
+ require 'rspec/rails'
264
+ require 'initial-test-data/factory_girl'
265
+
266
+ FactoryGirl.reload
267
+ ...
268
+
269
+ # spec/factories/customers.rb
270
+
271
+ FactoryGirl.define do
272
+ factory(:customer) do
273
+ sequence(:email) { |n| "test#{n}@example.com" }
274
+ given_name 'John',
275
+ family_name 'Doe'
276
+ end
277
+ end
278
+
248
279
  # spec/initial_data/customers.rb
249
280
 
250
281
  include FactoryGirl::Syntax::Methods
@@ -1,7 +1,3 @@
1
1
  require 'initial-test-data/initial_test_data'
2
2
  require 'initial-test-data/utilities'
3
3
  require 'initial-test-data/sequence_enumerator'
4
-
5
- if Object.const_defined?(:FactoryGirl)
6
- require 'initial-test-data/factory_girl_patches'
7
- end
@@ -1,4 +1,8 @@
1
1
  require 'active_support'
2
+ begin LoadError
3
+ require 'factory_girl'
4
+ rescue
5
+ end
2
6
 
3
7
  module FactoryGirl
4
8
  module SequenceWithCachedEnumerator
@@ -9,5 +13,7 @@ module FactoryGirl
9
13
  end
10
14
  end
11
15
 
12
- Sequence.send(:prepend, SequenceWithCachedEnumerator)
16
+ if FactoryGirl.const_defined?(:Sequence)
17
+ Sequence.send(:prepend, SequenceWithCachedEnumerator)
18
+ end
13
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: initial-test-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsutomu KURODA
@@ -123,7 +123,7 @@ files:
123
123
  - MIT-LICENSE
124
124
  - README.md
125
125
  - lib/initial-test-data.rb
126
- - lib/initial-test-data/factory_girl_patches.rb
126
+ - lib/initial-test-data/factory_girl.rb
127
127
  - lib/initial-test-data/initial_test_data.rb
128
128
  - lib/initial-test-data/sequence_enumerator.rb
129
129
  - lib/initial-test-data/utilities.rb