pickle 0.4.8 → 0.4.9
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.
- data/Gemfile.lock.development +101 -85
- data/History.txt +9 -0
- data/README.rdoc +3 -2
- data/features/app/app.rb +11 -1
- data/features/app/fabricators.rb +6 -0
- data/features/pickle/create_from_fabrication.feature +46 -0
- data/features/support/pickle.rb +2 -0
- data/lib/pickle/adapter.rb +24 -0
- data/lib/pickle/config.rb +1 -1
- data/lib/pickle/version.rb +1 -1
- data/pickle.gemspec +6 -5
- data/rails_generators/pickle/templates/pickle.rb +3 -1
- data/spec/pickle/adapter_spec.rb +41 -2
- data/spec/pickle/config_spec.rb +8 -5
- metadata +39 -25
data/Gemfile.lock.development
CHANGED
|
@@ -1,129 +1,144 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pickle (0.4.
|
|
4
|
+
pickle (0.4.9)
|
|
5
5
|
cucumber (>= 0.8)
|
|
6
6
|
rake
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: http://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
rack (~> 1.
|
|
22
|
-
rack-mount (~> 0.
|
|
23
|
-
rack-test (~> 0.
|
|
24
|
-
|
|
25
|
-
activemodel (3.0
|
|
26
|
-
activesupport (= 3.0
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
11
|
+
actionmailer (3.1.0)
|
|
12
|
+
actionpack (= 3.1.0)
|
|
13
|
+
mail (~> 2.3.0)
|
|
14
|
+
actionpack (3.1.0)
|
|
15
|
+
activemodel (= 3.1.0)
|
|
16
|
+
activesupport (= 3.1.0)
|
|
17
|
+
builder (~> 3.0.0)
|
|
18
|
+
erubis (~> 2.7.0)
|
|
19
|
+
i18n (~> 0.6)
|
|
20
|
+
rack (~> 1.3.2)
|
|
21
|
+
rack-cache (~> 1.0.3)
|
|
22
|
+
rack-mount (~> 0.8.2)
|
|
23
|
+
rack-test (~> 0.6.1)
|
|
24
|
+
sprockets (~> 2.0.0)
|
|
25
|
+
activemodel (3.1.0)
|
|
26
|
+
activesupport (= 3.1.0)
|
|
27
|
+
bcrypt-ruby (~> 3.0.0)
|
|
28
|
+
builder (~> 3.0.0)
|
|
29
|
+
i18n (~> 0.6)
|
|
30
|
+
activerecord (3.1.0)
|
|
31
|
+
activemodel (= 3.1.0)
|
|
32
|
+
activesupport (= 3.1.0)
|
|
33
|
+
arel (~> 2.2.1)
|
|
34
|
+
tzinfo (~> 0.3.29)
|
|
35
|
+
activeresource (3.1.0)
|
|
36
|
+
activemodel (= 3.1.0)
|
|
37
|
+
activesupport (= 3.1.0)
|
|
38
|
+
activesupport (3.1.0)
|
|
39
|
+
multi_json (~> 1.0)
|
|
40
|
+
arel (2.2.1)
|
|
41
|
+
bcrypt-ruby (3.0.1)
|
|
42
|
+
builder (3.0.0)
|
|
43
|
+
capybara (1.1.1)
|
|
41
44
|
mime-types (>= 1.16)
|
|
42
45
|
nokogiri (>= 1.3.3)
|
|
43
46
|
rack (>= 1.0.0)
|
|
44
47
|
rack-test (>= 0.5.4)
|
|
45
|
-
selenium-webdriver (~>
|
|
48
|
+
selenium-webdriver (~> 2.0)
|
|
46
49
|
xpath (~> 0.1.4)
|
|
47
|
-
childprocess (0.
|
|
50
|
+
childprocess (0.2.2)
|
|
48
51
|
ffi (~> 1.0.6)
|
|
49
|
-
cucumber (1.0.
|
|
52
|
+
cucumber (1.0.6)
|
|
50
53
|
builder (>= 2.1.2)
|
|
51
54
|
diff-lcs (>= 1.1.2)
|
|
52
|
-
gherkin (~> 2.4.
|
|
55
|
+
gherkin (~> 2.4.18)
|
|
53
56
|
json (>= 1.4.6)
|
|
54
|
-
term-ansicolor (>= 1.0.
|
|
55
|
-
cucumber-rails (1.0.
|
|
56
|
-
capybara (>= 1.
|
|
57
|
-
cucumber (~> 1.0.
|
|
58
|
-
nokogiri (>= 1.
|
|
57
|
+
term-ansicolor (>= 1.0.6)
|
|
58
|
+
cucumber-rails (1.0.5)
|
|
59
|
+
capybara (>= 1.1.1)
|
|
60
|
+
cucumber (~> 1.0.6)
|
|
61
|
+
nokogiri (>= 1.5.0)
|
|
59
62
|
database_cleaner (0.6.7)
|
|
60
|
-
diff-lcs (1.1.
|
|
61
|
-
erubis (2.
|
|
62
|
-
|
|
63
|
-
factory_girl (1.
|
|
63
|
+
diff-lcs (1.1.3)
|
|
64
|
+
erubis (2.7.0)
|
|
65
|
+
fabrication (1.1.0)
|
|
66
|
+
factory_girl (2.1.0)
|
|
64
67
|
ffi (1.0.9)
|
|
65
|
-
gherkin (2.4.
|
|
68
|
+
gherkin (2.4.21)
|
|
66
69
|
json (>= 1.4.6)
|
|
67
70
|
git (1.2.5)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
hike (1.2.1)
|
|
72
|
+
i18n (0.6.0)
|
|
73
|
+
json (1.6.1)
|
|
74
|
+
json_pure (1.6.1)
|
|
71
75
|
machinist (1.0.6)
|
|
72
|
-
mail (2.
|
|
73
|
-
activesupport (>= 2.3.6)
|
|
76
|
+
mail (2.3.0)
|
|
74
77
|
i18n (>= 0.4.0)
|
|
75
78
|
mime-types (~> 1.16)
|
|
76
79
|
treetop (~> 1.4.8)
|
|
77
80
|
mime-types (1.16)
|
|
81
|
+
multi_json (1.0.3)
|
|
78
82
|
nokogiri (1.5.0)
|
|
79
|
-
polyglot (0.3.
|
|
80
|
-
rack (1.
|
|
81
|
-
rack-
|
|
83
|
+
polyglot (0.3.2)
|
|
84
|
+
rack (1.3.3)
|
|
85
|
+
rack-cache (1.0.3)
|
|
86
|
+
rack (>= 0.4)
|
|
87
|
+
rack-mount (0.8.3)
|
|
82
88
|
rack (>= 1.0.0)
|
|
83
|
-
rack-
|
|
89
|
+
rack-ssl (1.3.2)
|
|
90
|
+
rack
|
|
91
|
+
rack-test (0.6.1)
|
|
84
92
|
rack (>= 1.0)
|
|
85
|
-
rails (3.0
|
|
86
|
-
actionmailer (= 3.0
|
|
87
|
-
actionpack (= 3.0
|
|
88
|
-
activerecord (= 3.0
|
|
89
|
-
activeresource (= 3.0
|
|
90
|
-
activesupport (= 3.0
|
|
93
|
+
rails (3.1.0)
|
|
94
|
+
actionmailer (= 3.1.0)
|
|
95
|
+
actionpack (= 3.1.0)
|
|
96
|
+
activerecord (= 3.1.0)
|
|
97
|
+
activeresource (= 3.1.0)
|
|
98
|
+
activesupport (= 3.1.0)
|
|
91
99
|
bundler (~> 1.0)
|
|
92
|
-
railties (= 3.0
|
|
93
|
-
railties (3.0
|
|
94
|
-
actionpack (= 3.0
|
|
95
|
-
activesupport (= 3.0
|
|
100
|
+
railties (= 3.1.0)
|
|
101
|
+
railties (3.1.0)
|
|
102
|
+
actionpack (= 3.1.0)
|
|
103
|
+
activesupport (= 3.1.0)
|
|
104
|
+
rack-ssl (~> 1.3.2)
|
|
96
105
|
rake (>= 0.8.7)
|
|
97
106
|
rdoc (~> 3.4)
|
|
98
|
-
thor (~> 0.14.
|
|
107
|
+
thor (~> 0.14.6)
|
|
99
108
|
rake (0.9.2)
|
|
100
|
-
rcov (0.9.
|
|
101
|
-
rdoc (3.
|
|
102
|
-
rspec (2.
|
|
103
|
-
rspec-core (~> 2.
|
|
104
|
-
rspec-expectations (~> 2.
|
|
105
|
-
rspec-mocks (~> 2.
|
|
106
|
-
rspec-core (2.
|
|
107
|
-
rspec-expectations (2.
|
|
109
|
+
rcov (0.9.10)
|
|
110
|
+
rdoc (3.9.4)
|
|
111
|
+
rspec (2.6.0)
|
|
112
|
+
rspec-core (~> 2.6.0)
|
|
113
|
+
rspec-expectations (~> 2.6.0)
|
|
114
|
+
rspec-mocks (~> 2.6.0)
|
|
115
|
+
rspec-core (2.6.4)
|
|
116
|
+
rspec-expectations (2.6.0)
|
|
108
117
|
diff-lcs (~> 1.1.2)
|
|
109
|
-
rspec-mocks (2.
|
|
110
|
-
rspec-rails (2.
|
|
118
|
+
rspec-mocks (2.6.0)
|
|
119
|
+
rspec-rails (2.6.1)
|
|
111
120
|
actionpack (~> 3.0)
|
|
112
121
|
activesupport (~> 3.0)
|
|
113
122
|
railties (~> 3.0)
|
|
114
|
-
rspec (~> 2.
|
|
123
|
+
rspec (~> 2.6.0)
|
|
115
124
|
rubyzip (0.9.4)
|
|
116
|
-
selenium-webdriver (
|
|
117
|
-
childprocess (>= 0.1
|
|
125
|
+
selenium-webdriver (2.6.0)
|
|
126
|
+
childprocess (>= 0.2.1)
|
|
118
127
|
ffi (>= 1.0.7)
|
|
119
128
|
json_pure
|
|
120
129
|
rubyzip
|
|
121
|
-
|
|
130
|
+
sprockets (2.0.0)
|
|
131
|
+
hike (~> 1.2)
|
|
132
|
+
rack (~> 1.0)
|
|
133
|
+
tilt (!= 1.3.0, ~> 1.1)
|
|
134
|
+
sqlite3 (1.3.4)
|
|
122
135
|
sqlite3-ruby (1.3.3)
|
|
123
136
|
sqlite3 (>= 1.3.3)
|
|
124
|
-
term-ansicolor (1.0.
|
|
137
|
+
term-ansicolor (1.0.6)
|
|
125
138
|
thor (0.14.6)
|
|
126
|
-
|
|
139
|
+
tilt (1.3.3)
|
|
140
|
+
treetop (1.4.10)
|
|
141
|
+
polyglot
|
|
127
142
|
polyglot (>= 0.3.1)
|
|
128
143
|
tzinfo (0.3.29)
|
|
129
144
|
xpath (0.1.4)
|
|
@@ -136,15 +151,16 @@ PLATFORMS
|
|
|
136
151
|
DEPENDENCIES
|
|
137
152
|
bundler
|
|
138
153
|
capybara
|
|
139
|
-
cucumber-rails
|
|
154
|
+
cucumber-rails
|
|
140
155
|
database_cleaner
|
|
156
|
+
fabrication
|
|
141
157
|
factory_girl
|
|
142
158
|
git
|
|
143
159
|
machinist
|
|
144
160
|
pickle!
|
|
145
|
-
rack
|
|
146
|
-
rails (~> 3.0
|
|
161
|
+
rack
|
|
162
|
+
rails (~> 3.1.0)
|
|
147
163
|
rcov
|
|
148
|
-
rspec-rails (~> 2.
|
|
164
|
+
rspec-rails (~> 2.6.0)
|
|
149
165
|
sqlite3-ruby
|
|
150
166
|
yard
|
data/History.txt
CHANGED
data/README.rdoc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= pickle
|
|
2
2
|
|
|
3
|
-
Pickle gives you cucumber steps that create your models easily from factory-girl
|
|
4
|
-
machinist
|
|
3
|
+
Pickle gives you cucumber steps that create your models easily from factory-girl,
|
|
4
|
+
machinist, or fabrication. You can also just use ActiveRecord as a factory but it's not as cool.
|
|
5
5
|
|
|
6
6
|
Pickle can make use of different ORMs for finding records. Currently ActiveRecord, DataMapper, MongoID adapters are
|
|
7
7
|
provided. More adapters welcome!
|
|
@@ -458,6 +458,7 @@ To run the specs & features do:
|
|
|
458
458
|
|
|
459
459
|
The following people have made Pickle better:
|
|
460
460
|
|
|
461
|
+
* {David Padilla}[http://github.com/dabit]
|
|
461
462
|
* {Ari Epstein}[http://github.com/aepstein]
|
|
462
463
|
* {Jonathan Hinkle}[http://github.com/hynkle]
|
|
463
464
|
* {Devin Walters and Nick Karpenske}[http://github.com/bendyworks]
|
data/features/app/app.rb
CHANGED
|
@@ -31,6 +31,11 @@ ActiveRecord::Migration.suppress_messages do
|
|
|
31
31
|
t.decimal :attitude_score, :precision => 4, :scale => 2
|
|
32
32
|
t.boolean :has_stale_password, :default => false
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
create_table :knives, :force => true do |t|
|
|
36
|
+
t.string :name
|
|
37
|
+
t.boolean :sharp, :null => false
|
|
38
|
+
end
|
|
34
39
|
end
|
|
35
40
|
end
|
|
36
41
|
|
|
@@ -59,6 +64,11 @@ class Spoon < ActiveRecord::Base
|
|
|
59
64
|
validates_presence_of :name
|
|
60
65
|
end
|
|
61
66
|
|
|
67
|
+
# Fabricator class
|
|
68
|
+
class Knife < ActiveRecord::Base
|
|
69
|
+
validates_presence_of :name
|
|
70
|
+
end
|
|
71
|
+
|
|
62
72
|
# we don't want abstract classes getting in there
|
|
63
73
|
class AbstractUser < ActiveRecord::Base
|
|
64
74
|
self.abstract_class = true
|
|
@@ -115,4 +125,4 @@ class Notifier < ActionMailer::Base
|
|
|
115
125
|
@subject = subject
|
|
116
126
|
@body = body
|
|
117
127
|
end
|
|
118
|
-
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Feature: I can easily create models with Fabrication
|
|
2
|
+
|
|
3
|
+
As a fabrication user
|
|
4
|
+
I want to be able to leverage my fabricators
|
|
5
|
+
So that I can create models quickly and easily in my features
|
|
6
|
+
|
|
7
|
+
Scenario: I create a knife, and see if it looks right
|
|
8
|
+
Given a knife exists
|
|
9
|
+
Then the knife should be sharp
|
|
10
|
+
And the knife's sharp should be true
|
|
11
|
+
|
|
12
|
+
Scenario: I create a blunt knife, and see if it looks right
|
|
13
|
+
Given a knife exists with sharp: false
|
|
14
|
+
Then the knife should not be sharp
|
|
15
|
+
|
|
16
|
+
Scenario: I create a named knife, and see if it has the name
|
|
17
|
+
Given a knife exists with name: "John", sharp: false
|
|
18
|
+
Then a knife should exist with name: "John"
|
|
19
|
+
And the knife should not be sharp
|
|
20
|
+
|
|
21
|
+
Scenario: I create 7 knives of various sharpness
|
|
22
|
+
Given 2 knives exist with sharp: false
|
|
23
|
+
And 2 knives exist with sharp: true
|
|
24
|
+
And a knife exists with sharp: false
|
|
25
|
+
|
|
26
|
+
Then the 1st knife should not be sharp
|
|
27
|
+
And the 2nd knife should not be sharp
|
|
28
|
+
And the 3rd knife should be sharp
|
|
29
|
+
And the 4th knife should be sharp
|
|
30
|
+
And the 5th knife should not be sharp
|
|
31
|
+
|
|
32
|
+
And 3 knives should exist with sharp: false
|
|
33
|
+
And the 1st knife should not be sharp
|
|
34
|
+
And the 2nd knife should not be sharp
|
|
35
|
+
And the last knife should not be sharp
|
|
36
|
+
|
|
37
|
+
And 2 knives should exist with sharp: true
|
|
38
|
+
And the first knife should be sharp
|
|
39
|
+
And the last knife should be sharp
|
|
40
|
+
|
|
41
|
+
Scenario: ModelNotKnownError should be informative when failing to find
|
|
42
|
+
Given a knife exists with sharp: true
|
|
43
|
+
Then the following should raise a Pickle::Session::ModelNotFoundError with "Can't find a knife with sharp: false from the orm in this scenario":
|
|
44
|
+
"""
|
|
45
|
+
Then a knife should exist with sharp: false
|
|
46
|
+
"""
|
data/features/support/pickle.rb
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
# require 'factory_girl'
|
|
14
14
|
# require File.dirname(__FILE__) + '/../../spec/factories' # or wherever your factories are
|
|
15
15
|
#
|
|
16
|
+
# For Fabrication, just include it in the adapter list when configuring pickle as explained below.
|
|
17
|
+
#
|
|
16
18
|
# You may also need to add gem dependencies on your factory of choice in <tt>config/environments/cucumber.rb</tt>
|
|
17
19
|
|
|
18
20
|
require 'pickle/world'
|
data/lib/pickle/adapter.rb
CHANGED
|
@@ -132,6 +132,30 @@ module Pickle
|
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
+
# fabrication adapter
|
|
136
|
+
class Fabrication < Adapter
|
|
137
|
+
def self.factories
|
|
138
|
+
if defined? ::Fabrication
|
|
139
|
+
::Fabrication::Support.find_definitions if ::Fabrication::Fabricator.schematics.empty?
|
|
140
|
+
::Fabrication::Fabricator.schematics.collect{|v| new(v)}
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def initialize(factory)
|
|
145
|
+
if defined? ::Fabrication
|
|
146
|
+
@klass, @name = factory[1].klass, factory[0].to_s
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def create(attrs = {})
|
|
151
|
+
if defined? ::Fabrication
|
|
152
|
+
::Fabrication::Fabricator.generate(@name.to_sym, {
|
|
153
|
+
:save => true
|
|
154
|
+
}, attrs)
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
135
159
|
# ORM adapter. If you have no factory adapter, you can use this adapter to
|
|
136
160
|
# use your orm as 'factory' - ie create objects
|
|
137
161
|
class Orm < Adapter
|
data/lib/pickle/config.rb
CHANGED
data/lib/pickle/version.rb
CHANGED
data/pickle.gemspec
CHANGED
|
@@ -21,17 +21,18 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.add_dependency "cucumber", ">=0.8"
|
|
22
22
|
s.add_dependency "rake"
|
|
23
23
|
|
|
24
|
-
s.add_development_dependency "rack"
|
|
24
|
+
s.add_development_dependency "rack"
|
|
25
25
|
s.add_development_dependency "bundler"
|
|
26
26
|
s.add_development_dependency "git"
|
|
27
27
|
s.add_development_dependency "yard"
|
|
28
|
-
s.add_development_dependency "rspec-rails", "~>2.
|
|
29
|
-
s.add_development_dependency "rails", "~>3.0
|
|
30
|
-
s.add_development_dependency "cucumber-rails"
|
|
28
|
+
s.add_development_dependency "rspec-rails", "~>2.6.0"
|
|
29
|
+
s.add_development_dependency "rails", "~>3.1.0"
|
|
30
|
+
s.add_development_dependency "cucumber-rails"
|
|
31
31
|
s.add_development_dependency "factory_girl"
|
|
32
|
+
s.add_development_dependency "fabrication"
|
|
32
33
|
s.add_development_dependency "machinist"
|
|
33
34
|
s.add_development_dependency "rcov"
|
|
34
35
|
s.add_development_dependency "database_cleaner"
|
|
35
36
|
s.add_development_dependency "capybara"
|
|
36
37
|
s.add_development_dependency "sqlite3-ruby"
|
|
37
|
-
end
|
|
38
|
+
end
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
# require 'factory_girl'
|
|
14
14
|
# require File.dirname(__FILE__) + '/../../spec/factories' # or wherever your factories are
|
|
15
15
|
#
|
|
16
|
+
# For Fabrication, just include it in the adapter list when configuring pickle as explained below.
|
|
17
|
+
#
|
|
16
18
|
# You may also need to add gem dependencies on your factory of choice in <tt>config/environments/cucumber.rb</tt>
|
|
17
19
|
|
|
18
20
|
require 'pickle/world'
|
|
@@ -25,4 +27,4 @@ require 'pickle/world'
|
|
|
25
27
|
<%- if pickle_path -%>require 'pickle/path/world'
|
|
26
28
|
<%- end -%>
|
|
27
29
|
<%- if pickle_email -%>require 'pickle/email/world'
|
|
28
|
-
<%- end -%>
|
|
30
|
+
<%- end -%>
|
data/spec/pickle/adapter_spec.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
require 'active_record'
|
|
4
4
|
require 'factory_girl'
|
|
5
|
+
require 'fabrication'
|
|
5
6
|
require 'machinist/active_record'
|
|
6
7
|
require 'pickle/adapters/active_record'
|
|
7
8
|
|
|
@@ -72,7 +73,7 @@ describe Pickle::Adapter do
|
|
|
72
73
|
describe 'FactoryGirl' do
|
|
73
74
|
before do
|
|
74
75
|
Pickle::Adapter::FactoryGirl.stub!(:model_classes).and_return([@klass1, @klass2, @klass3])
|
|
75
|
-
|
|
76
|
+
|
|
76
77
|
if defined? ::FactoryGirl
|
|
77
78
|
@orig_factories = ::FactoryGirl.factories.dup
|
|
78
79
|
::FactoryGirl.factories.clear
|
|
@@ -125,7 +126,45 @@ describe Pickle::Adapter do
|
|
|
125
126
|
end
|
|
126
127
|
end
|
|
127
128
|
end
|
|
128
|
-
|
|
129
|
+
|
|
130
|
+
describe 'Fabrication' do
|
|
131
|
+
before do
|
|
132
|
+
@schematic1 = [:one, Fabrication::Schematic.new(@klass1)]
|
|
133
|
+
@schematic2 = [:two, Fabrication::Schematic.new(@klass2)]
|
|
134
|
+
::Fabrication::Fabricator.stub(:schematics).and_return([@schematic1, @schematic2])
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it '.factories should create one for each fabricator' do
|
|
138
|
+
Pickle::Adapter::Fabrication.should_receive(:new).with(@schematic1)
|
|
139
|
+
Pickle::Adapter::Fabrication.should_receive(:new).with(@schematic2)
|
|
140
|
+
|
|
141
|
+
Pickle::Adapter::Fabrication.factories
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
describe ".new" do
|
|
145
|
+
before do
|
|
146
|
+
@factory = Pickle::Adapter::Fabrication.new(@schematic1)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it ".new should have name of schematic name" do
|
|
150
|
+
@factory.name.should == 'one'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it "should have klass of build_class" do
|
|
154
|
+
@factory.klass.should == @klass1
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
describe ".create" do
|
|
159
|
+
it "returns the fabricated instance" do
|
|
160
|
+
@factory = Pickle::Adapter::Fabrication.new(@schematic1)
|
|
161
|
+
::Fabrication::Fabricator.should_receive(:generate).
|
|
162
|
+
with(@factory.name.to_sym, {:save => true}, {:attribute => 'value'})
|
|
163
|
+
@factory.create({:attribute => 'value'})
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
129
168
|
describe 'Machinist' do
|
|
130
169
|
before do
|
|
131
170
|
Pickle::Adapter::Machinist.stub!(:model_classes).and_return([@klass1, @klass2, @klass3])
|
data/spec/pickle/config_spec.rb
CHANGED
|
@@ -6,11 +6,11 @@ describe Pickle::Config do
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it "#adapters should default to :machinist, :factory_girl, :orm" do
|
|
9
|
-
@config.adapters.should == [:machinist, :factory_girl, :orm]
|
|
9
|
+
@config.adapters.should == [:machinist, :factory_girl, :fabrication, :orm]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "#adapter_classes should default to Adapter::Machinist, Adapter::FactoryGirl, Adapter::Orm" do
|
|
13
|
-
@config.adapter_classes.should == [Pickle::Adapter::Machinist, Pickle::Adapter::FactoryGirl, Pickle::Adapter::Orm]
|
|
13
|
+
@config.adapter_classes.should == [Pickle::Adapter::Machinist, Pickle::Adapter::FactoryGirl, Pickle::Adapter::Fabrication, Pickle::Adapter::Orm]
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
describe "setting adapters to [:machinist, SomeAdapter]" do
|
|
@@ -29,6 +29,7 @@ describe Pickle::Config do
|
|
|
29
29
|
it "should call adaptor.factories for each adaptor" do
|
|
30
30
|
Pickle::Adapter::Machinist.should_receive(:factories).and_return([])
|
|
31
31
|
Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([])
|
|
32
|
+
Pickle::Adapter::Fabrication.should_receive(:factories).and_return([])
|
|
32
33
|
Pickle::Adapter::Orm.should_receive(:factories).and_return([])
|
|
33
34
|
@config.factories
|
|
34
35
|
end
|
|
@@ -36,15 +37,17 @@ describe Pickle::Config do
|
|
|
36
37
|
it "should aggregate factories into a hash using factory name as key" do
|
|
37
38
|
Pickle::Adapter::Machinist.should_receive(:factories).and_return([@machinist = mock('machinist', :name => 'machinist')])
|
|
38
39
|
Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([@factory_girl = mock('factory_girl', :name => 'factory_girl')])
|
|
40
|
+
Pickle::Adapter::Fabrication.should_receive(:factories).and_return([@fabrication = mock('fabrication', :name => 'fabrication')])
|
|
39
41
|
Pickle::Adapter::Orm.should_receive(:factories).and_return([@orm = mock('orm', :name => 'orm')])
|
|
40
|
-
@config.factories.should == {'machinist' => @machinist, 'factory_girl' => @factory_girl, 'orm' => @orm}
|
|
42
|
+
@config.factories.should == {'machinist' => @machinist, 'factory_girl' => @factory_girl, 'fabrication' => @fabrication, 'orm' => @orm}
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
it "should give preference to adaptors first in the list" do
|
|
44
46
|
Pickle::Adapter::Machinist.should_receive(:factories).and_return([@machinist_one = mock('one', :name => 'one')])
|
|
45
47
|
Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([@factory_girl_one = mock('one', :name => 'one'), @factory_girl_two = mock('two', :name => 'two')])
|
|
46
|
-
Pickle::Adapter::
|
|
47
|
-
|
|
48
|
+
Pickle::Adapter::Fabrication.should_receive(:factories).and_return([@fabrication_one = mock('one', :name => 'one'), @fabrication_three = mock('three', :name => 'three')])
|
|
49
|
+
Pickle::Adapter::Orm.should_receive(:factories).and_return([@orm_two = mock('two', :name => 'two'), @orm_four = mock('four', :name => 'four')])
|
|
50
|
+
@config.factories.should == {'one' => @machinist_one, 'two' => @factory_girl_two, 'three' => @fabrication_three, 'four' => @orm_four}
|
|
48
51
|
end
|
|
49
52
|
end
|
|
50
53
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pickle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 29
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 0.4.
|
|
9
|
+
- 9
|
|
10
|
+
version: 0.4.9
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Ian White
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-09-19 00:00:00 +01:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -53,14 +53,12 @@ dependencies:
|
|
|
53
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
54
54
|
none: false
|
|
55
55
|
requirements:
|
|
56
|
-
- -
|
|
56
|
+
- - ">="
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
hash:
|
|
58
|
+
hash: 3
|
|
59
59
|
segments:
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
- 1
|
|
63
|
-
version: 1.2.1
|
|
60
|
+
- 0
|
|
61
|
+
version: "0"
|
|
64
62
|
type: :development
|
|
65
63
|
version_requirements: *id003
|
|
66
64
|
- !ruby/object:Gem::Dependency
|
|
@@ -113,12 +111,12 @@ dependencies:
|
|
|
113
111
|
requirements:
|
|
114
112
|
- - ~>
|
|
115
113
|
- !ruby/object:Gem::Version
|
|
116
|
-
hash:
|
|
114
|
+
hash: 23
|
|
117
115
|
segments:
|
|
118
116
|
- 2
|
|
119
|
-
-
|
|
117
|
+
- 6
|
|
120
118
|
- 0
|
|
121
|
-
version: 2.
|
|
119
|
+
version: 2.6.0
|
|
122
120
|
type: :development
|
|
123
121
|
version_requirements: *id007
|
|
124
122
|
- !ruby/object:Gem::Dependency
|
|
@@ -129,12 +127,12 @@ dependencies:
|
|
|
129
127
|
requirements:
|
|
130
128
|
- - ~>
|
|
131
129
|
- !ruby/object:Gem::Version
|
|
132
|
-
hash:
|
|
130
|
+
hash: 3
|
|
133
131
|
segments:
|
|
134
132
|
- 3
|
|
133
|
+
- 1
|
|
135
134
|
- 0
|
|
136
|
-
|
|
137
|
-
version: 3.0.5
|
|
135
|
+
version: 3.1.0
|
|
138
136
|
type: :development
|
|
139
137
|
version_requirements: *id008
|
|
140
138
|
- !ruby/object:Gem::Dependency
|
|
@@ -145,12 +143,10 @@ dependencies:
|
|
|
145
143
|
requirements:
|
|
146
144
|
- - ">="
|
|
147
145
|
- !ruby/object:Gem::Version
|
|
148
|
-
hash:
|
|
146
|
+
hash: 3
|
|
149
147
|
segments:
|
|
150
148
|
- 0
|
|
151
|
-
|
|
152
|
-
- 2
|
|
153
|
-
version: 0.3.2
|
|
149
|
+
version: "0"
|
|
154
150
|
type: :development
|
|
155
151
|
version_requirements: *id009
|
|
156
152
|
- !ruby/object:Gem::Dependency
|
|
@@ -168,7 +164,7 @@ dependencies:
|
|
|
168
164
|
type: :development
|
|
169
165
|
version_requirements: *id010
|
|
170
166
|
- !ruby/object:Gem::Dependency
|
|
171
|
-
name:
|
|
167
|
+
name: fabrication
|
|
172
168
|
prerelease: false
|
|
173
169
|
requirement: &id011 !ruby/object:Gem::Requirement
|
|
174
170
|
none: false
|
|
@@ -182,7 +178,7 @@ dependencies:
|
|
|
182
178
|
type: :development
|
|
183
179
|
version_requirements: *id011
|
|
184
180
|
- !ruby/object:Gem::Dependency
|
|
185
|
-
name:
|
|
181
|
+
name: machinist
|
|
186
182
|
prerelease: false
|
|
187
183
|
requirement: &id012 !ruby/object:Gem::Requirement
|
|
188
184
|
none: false
|
|
@@ -196,7 +192,7 @@ dependencies:
|
|
|
196
192
|
type: :development
|
|
197
193
|
version_requirements: *id012
|
|
198
194
|
- !ruby/object:Gem::Dependency
|
|
199
|
-
name:
|
|
195
|
+
name: rcov
|
|
200
196
|
prerelease: false
|
|
201
197
|
requirement: &id013 !ruby/object:Gem::Requirement
|
|
202
198
|
none: false
|
|
@@ -210,7 +206,7 @@ dependencies:
|
|
|
210
206
|
type: :development
|
|
211
207
|
version_requirements: *id013
|
|
212
208
|
- !ruby/object:Gem::Dependency
|
|
213
|
-
name:
|
|
209
|
+
name: database_cleaner
|
|
214
210
|
prerelease: false
|
|
215
211
|
requirement: &id014 !ruby/object:Gem::Requirement
|
|
216
212
|
none: false
|
|
@@ -224,7 +220,7 @@ dependencies:
|
|
|
224
220
|
type: :development
|
|
225
221
|
version_requirements: *id014
|
|
226
222
|
- !ruby/object:Gem::Dependency
|
|
227
|
-
name:
|
|
223
|
+
name: capybara
|
|
228
224
|
prerelease: false
|
|
229
225
|
requirement: &id015 !ruby/object:Gem::Requirement
|
|
230
226
|
none: false
|
|
@@ -237,6 +233,20 @@ dependencies:
|
|
|
237
233
|
version: "0"
|
|
238
234
|
type: :development
|
|
239
235
|
version_requirements: *id015
|
|
236
|
+
- !ruby/object:Gem::Dependency
|
|
237
|
+
name: sqlite3-ruby
|
|
238
|
+
prerelease: false
|
|
239
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
|
240
|
+
none: false
|
|
241
|
+
requirements:
|
|
242
|
+
- - ">="
|
|
243
|
+
- !ruby/object:Gem::Version
|
|
244
|
+
hash: 3
|
|
245
|
+
segments:
|
|
246
|
+
- 0
|
|
247
|
+
version: "0"
|
|
248
|
+
type: :development
|
|
249
|
+
version_requirements: *id016
|
|
240
250
|
description: Easy model creation and reference in your cucumber features
|
|
241
251
|
email: ian.w.white@gmail.com
|
|
242
252
|
executables: []
|
|
@@ -261,6 +271,7 @@ files:
|
|
|
261
271
|
- autotest/discover.rb
|
|
262
272
|
- features/app/app.rb
|
|
263
273
|
- features/app/blueprints.rb
|
|
274
|
+
- features/app/fabricators.rb
|
|
264
275
|
- features/app/factories.rb
|
|
265
276
|
- features/app/views/notifier/email.erb
|
|
266
277
|
- features/app/views/notifier/user_email.erb
|
|
@@ -269,6 +280,7 @@ files:
|
|
|
269
280
|
- features/path/models_page.feature
|
|
270
281
|
- features/path/named_route_page.feature
|
|
271
282
|
- features/pickle/create_from_active_record.feature
|
|
283
|
+
- features/pickle/create_from_fabrication.feature
|
|
272
284
|
- features/pickle/create_from_factory_girl.feature
|
|
273
285
|
- features/pickle/create_from_machinist.feature
|
|
274
286
|
- features/step_definitions/email_steps.rb
|
|
@@ -358,6 +370,7 @@ summary: Easy model creation and reference in your cucumber features.
|
|
|
358
370
|
test_files:
|
|
359
371
|
- features/app/app.rb
|
|
360
372
|
- features/app/blueprints.rb
|
|
373
|
+
- features/app/fabricators.rb
|
|
361
374
|
- features/app/factories.rb
|
|
362
375
|
- features/app/views/notifier/email.erb
|
|
363
376
|
- features/app/views/notifier/user_email.erb
|
|
@@ -366,6 +379,7 @@ test_files:
|
|
|
366
379
|
- features/path/models_page.feature
|
|
367
380
|
- features/path/named_route_page.feature
|
|
368
381
|
- features/pickle/create_from_active_record.feature
|
|
382
|
+
- features/pickle/create_from_fabrication.feature
|
|
369
383
|
- features/pickle/create_from_factory_girl.feature
|
|
370
384
|
- features/pickle/create_from_machinist.feature
|
|
371
385
|
- features/step_definitions/email_steps.rb
|