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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +33 -2
- data/lib/initial-test-data.rb +0 -4
- data/lib/initial-test-data/{factory_girl_patches.rb → factory_girl.rb} +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d95588e443768898d5547187d606fd796cf7f4
|
4
|
+
data.tar.gz: 6ca2346cdac11e3068d815e479a740edc72cbbce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d871df257a88d2aadea4eafe2323572cf660ba6c716a0b4b16f606dd647182a0f36ca225e46c7cce46c570e1a209406355380c8d8646573a096a7b64c60404
|
7
|
+
data.tar.gz: 94c78e1f4e73147a0858c3729461e3edadd503b61a3caf5bbb5cead92c1f7e720559998dc0666c76d761135f7cd4518b2192c37106d00c6762c3b5aca94b776a
|
data/CHANGELOG.md
CHANGED
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
|
data/lib/initial-test-data.rb
CHANGED
@@ -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
|
-
|
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.
|
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/
|
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
|