pickle 0.1.18 → 0.1.19
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/History.txt +5 -6
- data/VERSION +1 -1
- data/features/step_definitions/pickle_steps.rb +6 -0
- data/features/support/env.rb +3 -0
- data/lib/pickle/session.rb +2 -1
- data/pickle.gemspec +2 -2
- data/rails_generators/pickle/templates/pickle_steps.rb +6 -0
- data/spec/lib/pickle_session_spec.rb +19 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,14 +1,13 @@
|
|
1
|
-
== 0.1.
|
1
|
+
== 0.1.19
|
2
2
|
|
3
3
|
* 1 minor enhancement
|
4
|
-
*
|
5
|
-
|
4
|
+
* Add support for Cucumber tables [Tobi Knaup]
|
5
|
+
|
6
6
|
|
7
|
-
== 0.1.16 - 13 Oct 2009
|
7
|
+
== 0.1.16, 0.1.17, 0.1.18 - 13 Oct 2009
|
8
8
|
|
9
9
|
* 1 minor enhancement
|
10
|
-
* release gem on gemcutter and
|
11
|
-
|
10
|
+
* release gem on gemcutter and code on github
|
12
11
|
|
13
12
|
== 0.1.15 - 28 Aug 2009
|
14
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.19
|
@@ -10,6 +10,12 @@ Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do
|
|
10
10
|
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
11
11
|
end
|
12
12
|
|
13
|
+
# create models from a table
|
14
|
+
Given /^the following #{capture_plural_factory} exist$/ do |plural_factory, table|
|
15
|
+
name = plural_factory.singularize
|
16
|
+
table.hashes.each { |hash| create_model(name, hash) }
|
17
|
+
end
|
18
|
+
|
13
19
|
# find a model
|
14
20
|
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
15
21
|
find_model(name, fields).should_not be_nil
|
data/features/support/env.rb
CHANGED
@@ -11,10 +11,13 @@ Webrat.configure do |config|
|
|
11
11
|
config.mode = :rails
|
12
12
|
end
|
13
13
|
|
14
|
+
|
14
15
|
# Comment out the next line if you're not using RSpec's matchers (should / should_not) in your steps.
|
15
16
|
require 'cucumber/rails/rspec'
|
16
17
|
require 'webrat/core/matchers'
|
17
18
|
|
19
|
+
Cucumber::Rails::World.use_transactional_fixtures = true
|
20
|
+
|
18
21
|
# Pickle
|
19
22
|
require 'pickle/world'
|
20
23
|
require 'pickle/path/world'
|
data/lib/pickle/session.rb
CHANGED
@@ -23,7 +23,8 @@ module Pickle
|
|
23
23
|
def create_model(a_model_name, fields = nil)
|
24
24
|
factory, label = *parse_model(a_model_name)
|
25
25
|
raise ArgumentError, "Can't create with an ordinal (e.g. 1st user)" if label.is_a?(Integer)
|
26
|
-
|
26
|
+
fields = fields.instance_of?(Hash) ? fields.dup : parse_fields(fields)
|
27
|
+
record = pickle_config.factories[factory].create(fields)
|
27
28
|
store_model(factory, label, record)
|
28
29
|
end
|
29
30
|
|
data/pickle.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pickle}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.19"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ian White"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-20}
|
13
13
|
s.description = %q{Easy model creation and reference in your cucumber features}
|
14
14
|
s.email = %q{ian.w.white@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -10,6 +10,12 @@ Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do
|
|
10
10
|
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
11
11
|
end
|
12
12
|
|
13
|
+
# create models from a table
|
14
|
+
Given /^the following #{capture_plural_factory} exist$/ do |plural_factory, table|
|
15
|
+
name = plural_factory.singularize
|
16
|
+
table.hashes.each { |hash| create_model(name, hash) }
|
17
|
+
end
|
18
|
+
|
13
19
|
# find a model
|
14
20
|
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
15
21
|
find_model(name, fields).should_not be_nil
|
@@ -147,7 +147,25 @@ describe Pickle::Session do
|
|
147
147
|
model?('the user: "shirl"').should == false
|
148
148
|
end
|
149
149
|
end
|
150
|
-
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "with hash" do
|
153
|
+
def do_create_model
|
154
|
+
create_model('a user', {'foo' => 'bar'})
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should call Factory.create('user', {'foo' => 'bar'})" do
|
158
|
+
Factory.should_receive(:create).with('user', {'foo' => 'bar'}).and_return(@user)
|
159
|
+
do_create_model
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "after create," do
|
163
|
+
before { do_create_model }
|
164
|
+
|
165
|
+
it_should_behave_like "after storing a single user"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
151
169
|
end
|
152
170
|
|
153
171
|
describe '#find_model' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian White
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-20 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|