pickle 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock.development +58 -61
- data/History.txt +7 -0
- data/README.rdoc +1 -0
- data/lib/pickle/adapter.rb +17 -3
- data/lib/pickle/version.rb +1 -1
- data/pickle.gemspec +1 -1
- data/spec/pickle/adapter_spec.rb +27 -13
- data/spec/pickle/session_spec.rb +6 -4
- metadata +6 -6
data/Gemfile.lock.development
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pickle (0.4.
|
4
|
+
pickle (0.4.8)
|
5
5
|
cucumber (>= 0.8)
|
6
6
|
rake
|
7
7
|
|
@@ -9,104 +9,101 @@ GEM
|
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
11
|
abstract (1.0.0)
|
12
|
-
actionmailer (3.0.
|
13
|
-
actionpack (= 3.0.
|
14
|
-
mail (~> 2.2.
|
15
|
-
actionpack (3.0.
|
16
|
-
activemodel (= 3.0.
|
17
|
-
activesupport (= 3.0.
|
12
|
+
actionmailer (3.0.9)
|
13
|
+
actionpack (= 3.0.9)
|
14
|
+
mail (~> 2.2.19)
|
15
|
+
actionpack (3.0.9)
|
16
|
+
activemodel (= 3.0.9)
|
17
|
+
activesupport (= 3.0.9)
|
18
18
|
builder (~> 2.1.2)
|
19
19
|
erubis (~> 2.6.6)
|
20
|
-
i18n (~> 0.
|
20
|
+
i18n (~> 0.5.0)
|
21
21
|
rack (~> 1.2.1)
|
22
|
-
rack-mount (~> 0.6.
|
22
|
+
rack-mount (~> 0.6.14)
|
23
23
|
rack-test (~> 0.5.7)
|
24
24
|
tzinfo (~> 0.3.23)
|
25
|
-
activemodel (3.0.
|
26
|
-
activesupport (= 3.0.
|
25
|
+
activemodel (3.0.9)
|
26
|
+
activesupport (= 3.0.9)
|
27
27
|
builder (~> 2.1.2)
|
28
|
-
i18n (~> 0.
|
29
|
-
activerecord (3.0.
|
30
|
-
activemodel (= 3.0.
|
31
|
-
activesupport (= 3.0.
|
32
|
-
arel (~> 2.0.
|
28
|
+
i18n (~> 0.5.0)
|
29
|
+
activerecord (3.0.9)
|
30
|
+
activemodel (= 3.0.9)
|
31
|
+
activesupport (= 3.0.9)
|
32
|
+
arel (~> 2.0.10)
|
33
33
|
tzinfo (~> 0.3.23)
|
34
|
-
activeresource (3.0.
|
35
|
-
activemodel (= 3.0.
|
36
|
-
activesupport (= 3.0.
|
37
|
-
activesupport (3.0.
|
38
|
-
arel (2.0.
|
34
|
+
activeresource (3.0.9)
|
35
|
+
activemodel (= 3.0.9)
|
36
|
+
activesupport (= 3.0.9)
|
37
|
+
activesupport (3.0.9)
|
38
|
+
arel (2.0.10)
|
39
39
|
builder (2.1.2)
|
40
|
-
capybara (0.
|
41
|
-
celerity (>= 0.7.9)
|
42
|
-
culerity (>= 0.2.4)
|
40
|
+
capybara (1.0.0)
|
43
41
|
mime-types (>= 1.16)
|
44
42
|
nokogiri (>= 1.3.3)
|
45
43
|
rack (>= 1.0.0)
|
46
44
|
rack-test (>= 0.5.4)
|
47
|
-
selenium-webdriver (
|
48
|
-
xpath (~> 0.1.
|
49
|
-
|
50
|
-
childprocess (0.1.8)
|
45
|
+
selenium-webdriver (~> 0.2.0)
|
46
|
+
xpath (~> 0.1.4)
|
47
|
+
childprocess (0.1.9)
|
51
48
|
ffi (~> 1.0.6)
|
52
|
-
cucumber (0.
|
49
|
+
cucumber (1.0.1)
|
53
50
|
builder (>= 2.1.2)
|
54
51
|
diff-lcs (>= 1.1.2)
|
55
|
-
gherkin (
|
52
|
+
gherkin (~> 2.4.5)
|
56
53
|
json (>= 1.4.6)
|
57
54
|
term-ansicolor (>= 1.0.5)
|
58
|
-
cucumber-rails (0.
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
database_cleaner (0.6.6)
|
55
|
+
cucumber-rails (1.0.2)
|
56
|
+
capybara (>= 1.0.0)
|
57
|
+
cucumber (~> 1.0.0)
|
58
|
+
nokogiri (>= 1.4.6)
|
59
|
+
database_cleaner (0.6.7)
|
64
60
|
diff-lcs (1.1.2)
|
65
61
|
erubis (2.6.6)
|
66
62
|
abstract (>= 1.0.0)
|
67
63
|
factory_girl (1.3.3)
|
68
|
-
ffi (1.0.
|
69
|
-
|
70
|
-
gherkin (2.3.5)
|
64
|
+
ffi (1.0.9)
|
65
|
+
gherkin (2.4.5)
|
71
66
|
json (>= 1.4.6)
|
72
67
|
git (1.2.5)
|
73
68
|
i18n (0.5.0)
|
74
|
-
json (1.5.
|
75
|
-
json_pure (1.5.
|
69
|
+
json (1.5.3)
|
70
|
+
json_pure (1.5.3)
|
76
71
|
machinist (1.0.6)
|
77
|
-
mail (2.2.
|
72
|
+
mail (2.2.19)
|
78
73
|
activesupport (>= 2.3.6)
|
79
74
|
i18n (>= 0.4.0)
|
80
75
|
mime-types (~> 1.16)
|
81
76
|
treetop (~> 1.4.8)
|
82
77
|
mime-types (1.16)
|
83
|
-
nokogiri (1.
|
78
|
+
nokogiri (1.5.0)
|
84
79
|
polyglot (0.3.1)
|
85
|
-
rack (1.2.
|
80
|
+
rack (1.2.3)
|
86
81
|
rack-mount (0.6.14)
|
87
82
|
rack (>= 1.0.0)
|
88
83
|
rack-test (0.5.7)
|
89
84
|
rack (>= 1.0)
|
90
|
-
rails (3.0.
|
91
|
-
actionmailer (= 3.0.
|
92
|
-
actionpack (= 3.0.
|
93
|
-
activerecord (= 3.0.
|
94
|
-
activeresource (= 3.0.
|
95
|
-
activesupport (= 3.0.
|
85
|
+
rails (3.0.9)
|
86
|
+
actionmailer (= 3.0.9)
|
87
|
+
actionpack (= 3.0.9)
|
88
|
+
activerecord (= 3.0.9)
|
89
|
+
activeresource (= 3.0.9)
|
90
|
+
activesupport (= 3.0.9)
|
96
91
|
bundler (~> 1.0)
|
97
|
-
railties (= 3.0.
|
98
|
-
railties (3.0.
|
99
|
-
actionpack (= 3.0.
|
100
|
-
activesupport (= 3.0.
|
92
|
+
railties (= 3.0.9)
|
93
|
+
railties (3.0.9)
|
94
|
+
actionpack (= 3.0.9)
|
95
|
+
activesupport (= 3.0.9)
|
101
96
|
rake (>= 0.8.7)
|
97
|
+
rdoc (~> 3.4)
|
102
98
|
thor (~> 0.14.4)
|
103
|
-
rake (0.
|
99
|
+
rake (0.9.2)
|
104
100
|
rcov (0.9.9)
|
101
|
+
rdoc (3.8)
|
105
102
|
rspec (2.5.0)
|
106
103
|
rspec-core (~> 2.5.0)
|
107
104
|
rspec-expectations (~> 2.5.0)
|
108
105
|
rspec-mocks (~> 2.5.0)
|
109
|
-
rspec-core (2.5.
|
106
|
+
rspec-core (2.5.2)
|
110
107
|
rspec-expectations (2.5.0)
|
111
108
|
diff-lcs (~> 1.1.2)
|
112
109
|
rspec-mocks (2.5.0)
|
@@ -116,8 +113,8 @@ GEM
|
|
116
113
|
railties (~> 3.0)
|
117
114
|
rspec (~> 2.5.0)
|
118
115
|
rubyzip (0.9.4)
|
119
|
-
selenium-webdriver (0.
|
120
|
-
childprocess (>= 0.1.
|
116
|
+
selenium-webdriver (0.2.2)
|
117
|
+
childprocess (>= 0.1.9)
|
121
118
|
ffi (>= 1.0.7)
|
122
119
|
json_pure
|
123
120
|
rubyzip
|
@@ -128,10 +125,10 @@ GEM
|
|
128
125
|
thor (0.14.6)
|
129
126
|
treetop (1.4.9)
|
130
127
|
polyglot (>= 0.3.1)
|
131
|
-
tzinfo (0.3.
|
132
|
-
xpath (0.1.
|
128
|
+
tzinfo (0.3.29)
|
129
|
+
xpath (0.1.4)
|
133
130
|
nokogiri (~> 1.3)
|
134
|
-
yard (0.
|
131
|
+
yard (0.7.2)
|
135
132
|
|
136
133
|
PLATFORMS
|
137
134
|
ruby
|
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -458,6 +458,7 @@ To run the specs & features do:
|
|
458
458
|
|
459
459
|
The following people have made Pickle better:
|
460
460
|
|
461
|
+
* {Ari Epstein}[http://github.com/aepstein]
|
461
462
|
* {Jonathan Hinkle}[http://github.com/hynkle]
|
462
463
|
* {Devin Walters and Nick Karpenske}[http://github.com/bendyworks]
|
463
464
|
* {Marc Lee}[http://github.com/maleko]
|
data/lib/pickle/adapter.rb
CHANGED
@@ -106,15 +106,29 @@ module Pickle
|
|
106
106
|
# factory-girl adapter
|
107
107
|
class FactoryGirl < Adapter
|
108
108
|
def self.factories
|
109
|
-
|
109
|
+
if defined? ::FactoryGirl
|
110
|
+
factories = []
|
111
|
+
::FactoryGirl.factories.each {|v| factories << new(v)}
|
112
|
+
factories
|
113
|
+
else
|
114
|
+
(::Factory.factories.values rescue []).map {|factory| new(factory)}
|
115
|
+
end
|
110
116
|
end
|
111
117
|
|
112
118
|
def initialize(factory)
|
113
|
-
|
119
|
+
if defined? ::FactoryGirl
|
120
|
+
@klass, @name = factory.build_class, factory.name.to_s
|
121
|
+
else
|
122
|
+
@klass, @name = factory.build_class, factory.factory_name.to_s
|
123
|
+
end
|
114
124
|
end
|
115
125
|
|
116
126
|
def create(attrs = {})
|
117
|
-
|
127
|
+
if defined? ::FactoryGirl
|
128
|
+
::FactoryGirl.create(@name, attrs)
|
129
|
+
else
|
130
|
+
Factory(@name, attrs)
|
131
|
+
end
|
118
132
|
end
|
119
133
|
end
|
120
134
|
|
data/lib/pickle/version.rb
CHANGED
data/pickle.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = "ian.w.white@gmail.com"
|
12
12
|
s.homepage = "http://github.com/ianwhite/pickle"
|
13
13
|
|
14
|
-
s.rubyforge_project = "
|
14
|
+
s.rubyforge_project = "pickle"
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
data/spec/pickle/adapter_spec.rb
CHANGED
@@ -67,23 +67,35 @@ describe Pickle::Adapter do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
71
|
-
|
72
70
|
end
|
73
71
|
|
74
72
|
describe 'FactoryGirl' do
|
75
73
|
before do
|
76
74
|
Pickle::Adapter::FactoryGirl.stub!(:model_classes).and_return([@klass1, @klass2, @klass3])
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
|
76
|
+
if defined? ::FactoryGirl
|
77
|
+
@orig_factories = ::FactoryGirl.factories.dup
|
78
|
+
::FactoryGirl.factories.clear
|
79
|
+
::FactoryGirl::Syntax::Default::DSL.new.factory(:one, :class => @klass1) {}
|
80
|
+
::FactoryGirl::Syntax::Default::DSL.new.factory(:two, :class => @klass2) {}
|
81
|
+
@factory1 = ::FactoryGirl.factories[:one]
|
82
|
+
@factory2 = ::FactoryGirl.factories[:two]
|
83
|
+
else
|
84
|
+
@orig_factories, Factory.factories = Factory.factories, {}
|
85
|
+
Factory.define(:one, :class => @klass1) {}
|
86
|
+
Factory.define(:two, :class => @klass2) {}
|
87
|
+
@factory1 = Factory.factories[:one]
|
88
|
+
@factory2 = Factory.factories[:two]
|
89
|
+
end
|
83
90
|
end
|
84
91
|
|
85
92
|
after do
|
86
|
-
|
93
|
+
if defined? ::FactoryGirl
|
94
|
+
::FactoryGirl.factories.clear
|
95
|
+
@orig_factories.each {|f| ::FactoryGirl.factories.add(f) }
|
96
|
+
else
|
97
|
+
Factory.factories = @orig_factories
|
98
|
+
end
|
87
99
|
end
|
88
100
|
|
89
101
|
it ".factories should create one for each factory" do
|
@@ -105,13 +117,15 @@ describe Pickle::Adapter do
|
|
105
117
|
@factory.klass.should == @klass1
|
106
118
|
end
|
107
119
|
|
108
|
-
|
109
|
-
|
110
|
-
|
120
|
+
unless defined? ::FactoryGirl
|
121
|
+
it "#create(attrs) should call Factory(<:key>, attrs)" do
|
122
|
+
Factory.should_receive(:create).with("one", {:key => "val"})
|
123
|
+
@factory.create(:key => "val")
|
124
|
+
end
|
111
125
|
end
|
112
126
|
end
|
113
127
|
end
|
114
|
-
|
128
|
+
|
115
129
|
describe 'Machinist' do
|
116
130
|
before do
|
117
131
|
Pickle::Adapter::Machinist.stub!(:model_classes).and_return([@klass1, @klass2, @klass3])
|
data/spec/pickle/session_spec.rb
CHANGED
@@ -282,10 +282,12 @@ describe Pickle::Session do
|
|
282
282
|
describe 'creating \'a super admin: "fred"\', then \'a user: "shirl"\', \'then 1 super_admin\' (super_admin is factory that returns users)' do
|
283
283
|
let(:fred) { mock("fred", :class => user_class, :id => 2) }
|
284
284
|
let(:shirl) { mock("shirl", :class => user_class, :id => 3) }
|
285
|
-
let(:noname) { mock("noname", :class => user_class, :
|
286
|
-
|
287
|
-
|
288
|
-
Pickle::Adapter::FactoryGirl.new(mock(:build_class => user_class, :
|
285
|
+
let(:noname) { mock("noname", :class => user_class, :id => 4) }
|
286
|
+
|
287
|
+
if defined? ::FactoryGirl
|
288
|
+
let(:super_admin_factory) { Pickle::Adapter::FactoryGirl.new(mock(:build_class => user_class, :name => :super_admin)) }
|
289
|
+
else
|
290
|
+
let(:super_admin_factory) { Pickle::Adapter::FactoryGirl.new(mock(:build_class => user_class, :factory_name => :super_admin)) }
|
289
291
|
end
|
290
292
|
|
291
293
|
before do
|
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: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 8
|
10
|
+
version: 0.4.8
|
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-07-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -350,8 +350,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
350
|
version: 1.3.6
|
351
351
|
requirements: []
|
352
352
|
|
353
|
-
rubyforge_project:
|
354
|
-
rubygems_version: 1.
|
353
|
+
rubyforge_project: pickle
|
354
|
+
rubygems_version: 1.6.2
|
355
355
|
signing_key:
|
356
356
|
specification_version: 3
|
357
357
|
summary: Easy model creation and reference in your cucumber features.
|