factory_girl_json 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +43 -33
- data/factory_girl_json.gemspec +2 -1
- data/lib/factory_girl_json.rb +3 -14
- data/lib/factory_girl_json/exporter.rb +45 -51
- data/lib/factory_girl_json/version.rb +1 -1
- data/lib/tasks/factory_girl_json.rake +3 -14
- data/spec/factories/users.rb +1 -1
- data/spec/factory_girl_json_spec.rb +36 -27
- data/spec/serializers/user_serializer.rb +1 -4
- data/spec/spec_helper.rb +7 -0
- metadata +21 -22
- data/lib/factory_girl_json/factory_girl_ext/valid_options.rb +0 -12
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDk5ODJiZjYyZTZlMTYzZGQ5YjFkMjgzOWU1NWUyYWVjYTMyYzViNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmQ4ZTY5ZDc3NmVkNzQ5YTlhMTVjYjQ0MGQxMmE5MDUxMGE1ZTQxYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTUzNTA5MGFhMzM1MWUyNDg5OWE1NTRiY2I1ZjhkYWM0ZTc2ODNmOWJlODlh
|
10
|
+
NTkxZjBmOTI2ODVkOTQ4ZWIwNTkxZjJmMDMzMmZkMjNlNzE0ZjBjNjU0YTdk
|
11
|
+
YjM0ODJkNWNkZTMyZGFlNjgzNDk0M2NlYWZhYTgzOGNhOTQ2OTc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTVmZTZlMTFlZDZjMjc2ODI0YmQ3MzczNzU1NmRiNTMwZDVjNmVmYjM0ZmZh
|
14
|
+
YTZmNjA2ZGY5M2RjMWI1NzNlZGM2MmI4ODBhMjMyNzQ5MGY4ZWE4ZTE1ODQ3
|
15
|
+
NmE2NTg3ZDEzNTMwZmZiNDljNzU1NTk2MTVlYWI4NWFhN2Y1Yjk=
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ You can add another option `json_serializer` which indicates which class will be
|
|
42
42
|
age 12
|
43
43
|
end
|
44
44
|
|
45
|
-
factory :user_with_posts, parent: :user
|
45
|
+
factory :user_with_posts, parent: :user do
|
46
46
|
after(:create) do |user|
|
47
47
|
create :post, user: user
|
48
48
|
end
|
@@ -56,59 +56,69 @@ You can add another option `json_serializer` which indicates which class will be
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def to_json(options = {})
|
59
|
-
|
60
|
-
user = @user.as_json
|
61
|
-
user['user'].merge! posts
|
62
|
-
JSON.generate user
|
59
|
+
@user.to_json(include: :posts)
|
63
60
|
end
|
64
61
|
end
|
65
62
|
|
66
63
|
|
67
|
-
|
64
|
+
There is one available rake task
|
68
65
|
|
69
|
-
`RAILS_ENV=test bundle exec rake factory_girl_json:export[
|
66
|
+
`RAILS_ENV=test bundle exec rake factory_girl_json:export[factory,size,serializer]` # Note: no space between rake arguments
|
70
67
|
|
71
|
-
|
68
|
+
For example, running
|
69
|
+
|
70
|
+
`RAILS_ENV=test bundle exec rake factory_girl_json:export[user]`
|
71
|
+
|
72
|
+
will produce a `user.json` file with data:
|
72
73
|
|
73
74
|
{
|
74
|
-
"
|
75
|
+
"age": 12,
|
76
|
+
"email": "useremail1@email.com",
|
77
|
+
"id": 1,
|
78
|
+
"name": "user name 1"
|
79
|
+
}
|
80
|
+
|
81
|
+
`RAILS_ENV=test bundle exec rake factory_girl_json:export[user,2]`
|
82
|
+
|
83
|
+
will produce a `2.user.json` file with data:
|
84
|
+
|
85
|
+
[
|
86
|
+
{
|
75
87
|
"age": 12,
|
76
88
|
"email": "useremail1@email.com",
|
77
89
|
"id": 1,
|
78
90
|
"name": "user name 1"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"age": 12,
|
94
|
+
"email": "useremail2@email.com",
|
95
|
+
"id": 2,
|
96
|
+
"name": "user name 2"
|
79
97
|
}
|
80
|
-
|
98
|
+
]
|
81
99
|
|
82
|
-
`RAILS_ENV=test bundle exec rake factory_girl_json:export['user_with_posts']`
|
100
|
+
`RAILS_ENV=test bundle exec rake factory_girl_json:export['user_with_posts',1,UserSerializer]`
|
83
101
|
|
84
|
-
you will get a `user_with_posts.json` file with data:
|
102
|
+
you will get a `user_with_posts.user_serializer.json` file with data:
|
85
103
|
|
86
104
|
{
|
87
|
-
"
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
}
|
100
|
-
}
|
101
|
-
]
|
102
|
-
}
|
105
|
+
"age": 12,
|
106
|
+
"email": "useremail1@email.com",
|
107
|
+
"id": 1,
|
108
|
+
"name": "user name 1",
|
109
|
+
"posts": [
|
110
|
+
{
|
111
|
+
"body": "post body",
|
112
|
+
"id": 1,
|
113
|
+
"title": "post title",
|
114
|
+
"user_id": 1
|
115
|
+
}
|
116
|
+
]
|
103
117
|
}
|
104
118
|
|
105
|
-
### All rake tasks
|
106
|
-
rake factory_girl_json:all # Exports json fixtures for all FactoryGirl factories
|
107
|
-
rake factory_girl_json:export[factory_name] # Exports json fixture for the selected FactoryGirl factory
|
108
|
-
rake factory_girl_json:export_serialized # Exports json fixtures for FactoryGirl factories with the json_serializer option
|
109
119
|
|
110
120
|
### Default exporting paths
|
111
|
-
if Rails is used it will write the json files to `spec
|
121
|
+
if Rails is used it will write the json files to `spec/javascripts/fixtures/json` or `test/javascripts/fixtures/json`
|
112
122
|
otherwise it uses the current path.
|
113
123
|
|
114
124
|
## Contributing
|
data/factory_girl_json.gemspec
CHANGED
@@ -15,9 +15,10 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = FactoryGirlJson::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "factory_girl"
|
18
|
+
gem.add_dependency "factory_girl", ">= 4.1"
|
19
19
|
gem.add_dependency "json"
|
20
20
|
gem.add_dependency "database_cleaner"
|
21
|
+
gem.add_dependency "activesupport", ">= 3"
|
21
22
|
gem.add_development_dependency "rspec"
|
22
23
|
gem.add_development_dependency "activerecord"
|
23
24
|
gem.add_development_dependency "sqlite3"
|
data/lib/factory_girl_json.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'factory_girl'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'database_cleaner'
|
4
|
-
require '
|
4
|
+
require 'active_support/core_ext/string/inflections'
|
5
5
|
require 'factory_girl_json/version'
|
6
6
|
require 'factory_girl_json/exporter'
|
7
7
|
require 'factory_girl_json/railtie' if defined? Rails
|
@@ -9,25 +9,14 @@ require 'factory_girl_json/railtie' if defined? Rails
|
|
9
9
|
module FactoryGirlJson
|
10
10
|
class << self
|
11
11
|
|
12
|
-
def export(factory_name)
|
12
|
+
def export(factory_name, size = nil, serializer = nil)
|
13
13
|
clean
|
14
|
-
Exporter.new(factory_name).export
|
15
|
-
end
|
16
|
-
|
17
|
-
def export_all
|
18
|
-
clean
|
19
|
-
Exporter.new(:all).export
|
20
|
-
end
|
21
|
-
|
22
|
-
def export_serialized
|
23
|
-
clean
|
24
|
-
Exporter.new(:serialized).export
|
14
|
+
Exporter.new(factory_name, size, serializer).export
|
25
15
|
end
|
26
16
|
|
27
17
|
def clean
|
28
18
|
DatabaseCleaner.clean_with :truncation
|
29
19
|
DatabaseCleaner.clean
|
30
20
|
end
|
31
|
-
|
32
21
|
end
|
33
22
|
end
|
@@ -1,73 +1,67 @@
|
|
1
1
|
module FactoryGirlJson
|
2
2
|
class Exporter
|
3
|
-
def initialize(
|
4
|
-
@
|
5
|
-
|
3
|
+
def initialize(factory, size, serializer)
|
4
|
+
@factory = FactoryGirl.factories.find(factory.to_sym)
|
5
|
+
@size = size ? size.to_i : 1
|
6
|
+
@serializer = serializer.constantize if serializer
|
6
7
|
end
|
7
8
|
|
8
9
|
def export
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def export_factory(factory)
|
15
|
-
$stdout.puts "Exporting factory #{factory.name}"
|
16
|
-
path = file_path(factory)
|
10
|
+
$stdout.puts "Exporting factory #{@factory.name}"
|
11
|
+
path = file_path
|
17
12
|
unless File.exists? path
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
13
|
+
model_or_collection = if @size > 1
|
14
|
+
FactoryGirl.create_list(@factory.name.to_sym, @size)
|
15
|
+
else
|
16
|
+
@factory.run(:create, {})
|
17
|
+
end
|
25
18
|
|
26
|
-
|
27
|
-
|
28
|
-
serializer.new(model).to_json
|
19
|
+
json = to_json(model_or_collection)
|
20
|
+
write_file(json, path)
|
29
21
|
else
|
30
|
-
|
22
|
+
$stderr.puts "File #{file_name} exists, delete file and run again to rewrite"
|
31
23
|
end
|
32
24
|
end
|
33
25
|
|
34
|
-
|
35
|
-
FileUtils.mkdir_p File.dirname(path)
|
36
|
-
File.open(path, 'w') do |file|
|
37
|
-
file.puts JSON.pretty_generate(JSON.parse(json))
|
38
|
-
end
|
39
|
-
$stdout.puts "Wrote file #{path}"
|
40
|
-
end
|
26
|
+
private
|
41
27
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
Rails.root.join("spec/javascripts/fixtures/json/#{factory.name}.json").to_s
|
46
|
-
elsif Dir.exists? Rails.root.join('test').to_s
|
47
|
-
Rails.root.join("test/javascripts/fixtures/json/#{factory.name}.json").to_s
|
28
|
+
def to_json(model_or_collection)
|
29
|
+
if @serializer
|
30
|
+
@serializer.new(model_or_collection).to_json
|
48
31
|
else
|
49
|
-
|
32
|
+
model_or_collection.to_json
|
50
33
|
end
|
51
|
-
else
|
52
|
-
"#{Dir.pwd}/#{factory.name}.json"
|
53
34
|
end
|
54
|
-
end
|
55
35
|
|
56
|
-
|
36
|
+
def write_file(json, path)
|
37
|
+
FileUtils.mkdir_p File.dirname(path)
|
38
|
+
File.open(path, 'w') do |file|
|
39
|
+
file.puts JSON.pretty_generate(JSON.parse(json))
|
40
|
+
end
|
41
|
+
$stdout.puts "Wrote file #{path}"
|
42
|
+
end
|
57
43
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
44
|
+
def file_path
|
45
|
+
if defined? Rails
|
46
|
+
if Dir.exists? Rails.root.join('spec').to_s
|
47
|
+
Rails.root.join("spec/javascripts/fixtures/json/#{file_name}").to_s
|
48
|
+
elsif Dir.exists? Rails.root.join('test').to_s
|
49
|
+
Rails.root.join("test/javascripts/fixtures/json/#{file_name}").to_s
|
50
|
+
else
|
51
|
+
"#{Dir.pwd}/#{file_name}"
|
52
|
+
end
|
67
53
|
else
|
68
|
-
|
54
|
+
"#{Dir.pwd}/#{file_name}"
|
69
55
|
end
|
70
56
|
end
|
71
|
-
|
57
|
+
|
58
|
+
def file_name
|
59
|
+
name = ''
|
60
|
+
name << "#{@size}." if @size > 1
|
61
|
+
name << "#{@factory.name}"
|
62
|
+
name << ".#{@serializer.to_s.underscore}".gsub('/','_') if @serializer
|
63
|
+
name << '.json'
|
64
|
+
name
|
65
|
+
end
|
72
66
|
end
|
73
67
|
end
|
@@ -1,18 +1,7 @@
|
|
1
|
-
namespace :factory_girl_json do
|
2
|
-
|
3
|
-
desc 'Exports json fixtures for all FactoryGirl factories'
|
4
|
-
task :all => :environment do
|
5
|
-
FactoryGirlJson.export_all
|
6
|
-
end
|
7
|
-
|
1
|
+
namespace :factory_girl_json do
|
8
2
|
desc 'Exports json fixture for the selected FactoryGirl factory'
|
9
|
-
task :export, [:factory_name] => :environment do |t, args|
|
10
|
-
FactoryGirlJson.export args[:factory_name]
|
11
|
-
end
|
12
|
-
|
13
|
-
desc 'Exports json fixtures for FactoryGirl factories with the json_serializer option'
|
14
|
-
task :export_serialized => :environment do
|
15
|
-
FactoryGirlJson.export_serialized
|
3
|
+
task :export, [:factory_name, :size, :serializer] => :environment do |t, args|
|
4
|
+
FactoryGirlJson.export args[:factory_name], args[:size], args[:serializer]
|
16
5
|
end
|
17
6
|
end
|
18
7
|
|
data/spec/factories/users.rb
CHANGED
@@ -1,58 +1,67 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe FactoryGirlJson do
|
3
|
+
describe FactoryGirlJson do
|
4
|
+
after(:each) do
|
5
|
+
Dir['*.json'].each {|f| File.delete(f) }
|
6
|
+
end
|
7
|
+
|
4
8
|
it "should genarate a file" do
|
5
9
|
FactoryGirlJson.export('user')
|
6
10
|
path = "#{Dir.pwd}/user.json"
|
7
11
|
File.exists?(path).should be_true
|
8
|
-
File.delete path
|
9
12
|
end
|
10
13
|
|
11
14
|
it "should genarate a file with user json" do
|
12
15
|
FactoryGirlJson.export('user')
|
13
16
|
path = "#{Dir.pwd}/user.json"
|
14
17
|
File.exists?(path).should be_true
|
15
|
-
|
16
|
-
user = hash['user']
|
18
|
+
user = JSON.parse(File.read(path))
|
17
19
|
user['id'].should_not be_nil
|
18
20
|
user['name'].should_not be_nil
|
19
21
|
user['email'].should_not be_nil
|
20
22
|
user['age'].should_not be_nil
|
21
|
-
File.delete path
|
22
23
|
end
|
23
24
|
|
24
|
-
it "should use
|
25
|
-
FactoryGirlJson.export('user_with_posts')
|
26
|
-
path = "#{Dir.pwd}/user_with_posts.json"
|
25
|
+
it "should use the given serializer if present" do
|
26
|
+
FactoryGirlJson.export('user_with_posts', 1, 'UserSerializer')
|
27
|
+
path = "#{Dir.pwd}/user_with_posts.user_serializer.json"
|
27
28
|
File.exists?(path).should be_true
|
28
|
-
|
29
|
-
user = hash['user']
|
29
|
+
user = JSON.parse(File.read(path))
|
30
30
|
user['id'].should_not be_nil
|
31
31
|
user['name'].should_not be_nil
|
32
32
|
user['email'].should_not be_nil
|
33
33
|
user['age'].should_not be_nil
|
34
34
|
user['posts'].should_not be_nil
|
35
|
-
user['posts'][0]['
|
36
|
-
File.delete path
|
35
|
+
user['posts'][0]['title'].should_not be_nil
|
37
36
|
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
describe "exporting collections" do
|
39
|
+
it "should export the requested size" do
|
40
|
+
FactoryGirlJson.export('user', 4)
|
41
|
+
path = "#{Dir.pwd}/4.user.json"
|
42
|
+
File.exists?(path).should be_true
|
43
|
+
users = JSON.parse(File.read(path))
|
44
|
+
users.size.should be(4)
|
45
|
+
user = users.first
|
46
|
+
user['id'].should_not be_nil
|
47
|
+
user['name'].should_not be_nil
|
48
|
+
user['email'].should_not be_nil
|
49
|
+
user['age'].should_not be_nil
|
45
50
|
end
|
46
|
-
end
|
47
|
-
|
48
51
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
it "should export the requested size with serializer" do
|
53
|
+
FactoryGirlJson.export('user_with_posts', 2, 'UserSerializer')
|
54
|
+
path = "#{Dir.pwd}/2.user_with_posts.user_serializer.json"
|
55
|
+
File.exists?(path).should be_true
|
56
|
+
users = JSON.parse(File.read(path))
|
57
|
+
users.size.should be(2)
|
58
|
+
user = users.first
|
59
|
+
user['id'].should_not be_nil
|
60
|
+
user['name'].should_not be_nil
|
61
|
+
user['email'].should_not be_nil
|
62
|
+
user['age'].should_not be_nil
|
63
|
+
user['posts'].should_not be_nil
|
64
|
+
user['posts'][0]['title'].should_not be_nil
|
55
65
|
end
|
56
66
|
end
|
57
|
-
|
58
67
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,8 @@ require 'serializers/user_serializer'
|
|
6
6
|
require 'factories/posts'
|
7
7
|
require 'factories/users'
|
8
8
|
|
9
|
+
ActiveRecord::Base.include_root_in_json = false
|
10
|
+
|
9
11
|
ActiveRecord::Base.establish_connection(
|
10
12
|
:adapter => 'sqlite3',
|
11
13
|
:database => ':memory:'
|
@@ -26,4 +28,9 @@ ActiveRecord::Schema.define do
|
|
26
28
|
t.text :body
|
27
29
|
end
|
28
30
|
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec.configure do |config|
|
34
|
+
config.filter_run :focus => true
|
35
|
+
config.run_all_when_everything_filtered = true
|
29
36
|
end
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nikos Gereoudakis
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: factory_girl
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '4.1'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: database_cleaner
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,15 +48,27 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: rspec
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
73
|
- - ! '>='
|
68
74
|
- !ruby/object:Gem::Version
|
@@ -70,7 +76,6 @@ dependencies:
|
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
80
|
- - ! '>='
|
76
81
|
- !ruby/object:Gem::Version
|
@@ -78,7 +83,6 @@ dependencies:
|
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: activerecord
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
87
|
- - ! '>='
|
84
88
|
- !ruby/object:Gem::Version
|
@@ -86,7 +90,6 @@ dependencies:
|
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
94
|
- - ! '>='
|
92
95
|
- !ruby/object:Gem::Version
|
@@ -94,7 +97,6 @@ dependencies:
|
|
94
97
|
- !ruby/object:Gem::Dependency
|
95
98
|
name: sqlite3
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
100
|
requirements:
|
99
101
|
- - ! '>='
|
100
102
|
- !ruby/object:Gem::Version
|
@@ -102,7 +104,6 @@ dependencies:
|
|
102
104
|
type: :development
|
103
105
|
prerelease: false
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
107
|
requirements:
|
107
108
|
- - ! '>='
|
108
109
|
- !ruby/object:Gem::Version
|
@@ -123,7 +124,6 @@ files:
|
|
123
124
|
- factory_girl_json.gemspec
|
124
125
|
- lib/factory_girl_json.rb
|
125
126
|
- lib/factory_girl_json/exporter.rb
|
126
|
-
- lib/factory_girl_json/factory_girl_ext/valid_options.rb
|
127
127
|
- lib/factory_girl_json/railtie.rb
|
128
128
|
- lib/factory_girl_json/version.rb
|
129
129
|
- lib/tasks/factory_girl_json.rake
|
@@ -136,27 +136,26 @@ files:
|
|
136
136
|
- spec/spec_helper.rb
|
137
137
|
homepage: https://github.com/stream7/factory_girl_json
|
138
138
|
licenses: []
|
139
|
+
metadata: {}
|
139
140
|
post_install_message:
|
140
141
|
rdoc_options: []
|
141
142
|
require_paths:
|
142
143
|
- lib
|
143
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
145
|
requirements:
|
146
146
|
- - ! '>='
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
150
|
requirements:
|
152
151
|
- - ! '>='
|
153
152
|
- !ruby/object:Gem::Version
|
154
153
|
version: '0'
|
155
154
|
requirements: []
|
156
155
|
rubyforge_project:
|
157
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 2.1.0
|
158
157
|
signing_key:
|
159
|
-
specification_version:
|
158
|
+
specification_version: 4
|
160
159
|
summary: Create json fixtures from your FactoryGirl factories
|
161
160
|
test_files:
|
162
161
|
- spec/factories/posts.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module FactoryGirl
|
2
|
-
class Factory
|
3
|
-
attr_reader :json_serializer
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def assert_valid_options(options)
|
8
|
-
options.assert_valid_keys(:class, :parent, :aliases, :traits, :json_serializer)
|
9
|
-
@json_serializer = options[:json_serializer]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|