pickle 0.2.5 → 0.2.6
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/.gitignore +2 -0
- data/History.txt +7 -0
- data/README.rdoc +7 -10
- data/Rakefile +27 -46
- data/Todo.txt +0 -1
- data/VERSION +1 -1
- data/features/support/env.rb +1 -1
- data/lib/pickle/adapter.rb +18 -10
- data/lib/pickle/email.rb +1 -1
- data/pickle.gemspec +20 -21
- data/spec/{lib/pickle_adapter_spec.rb → pickle/adapter_spec.rb} +39 -20
- data/spec/{lib/pickle_config_spec.rb → pickle/config_spec.rb} +1 -1
- data/spec/{lib/pickle_email_parser_spec.rb → pickle/email/parser_spec.rb} +4 -2
- data/spec/{lib/pickle_email_spec.rb → pickle/email_spec.rb} +8 -4
- data/spec/{lib/pickle_parser_matchers_spec.rb → pickle/parser/matchers_spec.rb} +1 -1
- data/spec/pickle/parser_spec.rb +161 -0
- data/spec/{lib/pickle_path_spec.rb → pickle/path_spec.rb} +35 -26
- data/spec/{lib/pickle_session_spec.rb → pickle/session_spec.rb} +133 -130
- data/spec/{lib/pickle_spec.rb → pickle_spec.rb} +1 -1
- data/spec/spec_helper.rb +5 -37
- metadata +21 -22
- data/garlic.rb +0 -38
- data/spec/lib/pickle_parser_spec.rb +0 -154
data/spec/spec_helper.rb
CHANGED
@@ -1,38 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "../../../../config/environment"))
|
5
|
-
require 'spec/rails'
|
6
|
-
|
7
|
-
# APP SETUP
|
8
|
-
|
9
|
-
# Models
|
10
|
-
class User < ActiveRecord::Base
|
11
|
-
end
|
12
|
-
|
13
|
-
class FastCar < ActiveRecord::Base
|
14
|
-
end
|
15
|
-
|
16
|
-
class Event < ActiveRecord::Base
|
17
|
-
class Create < Event
|
18
|
-
end
|
19
|
-
|
20
|
-
class Update < Event
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Factories
|
25
|
-
require 'factory_girl'
|
26
|
-
|
27
|
-
Factory.define :user do |u|
|
28
|
-
end
|
29
|
-
|
30
|
-
Factory.define :super_admin, :class => User do |u|
|
31
|
-
end
|
32
|
-
|
33
|
-
Factory.define :fast_car do |c|
|
34
|
-
end
|
35
|
-
|
36
|
-
# Machinist
|
37
|
-
require 'machinist/active_record'
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
require 'activesupport'
|
38
4
|
|
5
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
6
|
+
require 'pickle'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 6
|
9
|
+
version: 0.2.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ian White
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-05 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- features/support/paths.rb
|
58
58
|
- features/support/pickle.rb
|
59
59
|
- features/support/pickle_app.rb
|
60
|
-
- garlic.rb
|
61
60
|
- init.rb
|
62
61
|
- lib/pickle.rb
|
63
62
|
- lib/pickle/adapter.rb
|
@@ -80,15 +79,15 @@ files:
|
|
80
79
|
- rails_generators/pickle/templates/paths.rb
|
81
80
|
- rails_generators/pickle/templates/pickle.rb
|
82
81
|
- rails_generators/pickle/templates/pickle_steps.rb
|
83
|
-
- spec/
|
84
|
-
- spec/
|
85
|
-
- spec/
|
86
|
-
- spec/
|
87
|
-
- spec/
|
88
|
-
- spec/
|
89
|
-
- spec/
|
90
|
-
- spec/
|
91
|
-
- spec/
|
82
|
+
- spec/pickle/adapter_spec.rb
|
83
|
+
- spec/pickle/config_spec.rb
|
84
|
+
- spec/pickle/email/parser_spec.rb
|
85
|
+
- spec/pickle/email_spec.rb
|
86
|
+
- spec/pickle/parser/matchers_spec.rb
|
87
|
+
- spec/pickle/parser_spec.rb
|
88
|
+
- spec/pickle/path_spec.rb
|
89
|
+
- spec/pickle/session_spec.rb
|
90
|
+
- spec/pickle_spec.rb
|
92
91
|
- spec/spec_helper.rb
|
93
92
|
has_rdoc: true
|
94
93
|
homepage: http://github.com/ianwhite/pickle/tree
|
@@ -121,13 +120,13 @@ signing_key:
|
|
121
120
|
specification_version: 3
|
122
121
|
summary: Easy model creation and reference in your cucumber features
|
123
122
|
test_files:
|
124
|
-
- spec/
|
125
|
-
- spec/
|
126
|
-
- spec/
|
127
|
-
- spec/
|
128
|
-
- spec/
|
129
|
-
- spec/
|
130
|
-
- spec/
|
131
|
-
- spec/
|
132
|
-
- spec/
|
123
|
+
- spec/pickle/adapter_spec.rb
|
124
|
+
- spec/pickle/config_spec.rb
|
125
|
+
- spec/pickle/email/parser_spec.rb
|
126
|
+
- spec/pickle/email_spec.rb
|
127
|
+
- spec/pickle/parser/matchers_spec.rb
|
128
|
+
- spec/pickle/parser_spec.rb
|
129
|
+
- spec/pickle/path_spec.rb
|
130
|
+
- spec/pickle/session_spec.rb
|
131
|
+
- spec/pickle_spec.rb
|
133
132
|
- spec/spec_helper.rb
|
data/garlic.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
garlic do
|
2
|
-
repo 'rails', :url => 'git://github.com/rails/rails'
|
3
|
-
repo 'rspec', :url => 'git://github.com/dchelimsky/rspec'
|
4
|
-
repo 'rspec-rails', :url => 'git://github.com/dchelimsky/rspec-rails'
|
5
|
-
repo 'factory_girl', :url => 'git://github.com/thoughtbot/factory_girl'
|
6
|
-
repo 'machinist', :url => 'git://github.com/notahat/machinist'
|
7
|
-
repo 'cucumber', :url => 'git://github.com/aslakhellesoy/cucumber'
|
8
|
-
repo 'cucumber-rails', :url => 'git://github.com/aslakhellesoy/cucumber-rails'
|
9
|
-
repo 'webrat', :url => 'git://github.com/brynary/webrat'
|
10
|
-
repo 'pickle', :path => '.'
|
11
|
-
|
12
|
-
['2-3-stable', '2-2-stable', '2-1-stable'].each do |rails|
|
13
|
-
|
14
|
-
target rails, :tree_ish => "origin/#{rails}" do
|
15
|
-
prepare do
|
16
|
-
plugin 'pickle', :clone => true
|
17
|
-
plugin 'rspec'
|
18
|
-
plugin 'rspec-rails' do
|
19
|
-
`script/generate rspec -f`
|
20
|
-
end
|
21
|
-
plugin 'factory_girl'
|
22
|
-
plugin 'cucumber'
|
23
|
-
plugin 'machinist'
|
24
|
-
plugin 'webrat'
|
25
|
-
plugin 'cucumber-rails' do
|
26
|
-
`script/generate cucumber --webrat -f`
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
run do
|
31
|
-
cd "vendor/plugins/pickle" do
|
32
|
-
sh "rake rcov:verify && rake features"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,154 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
|
2
|
-
|
3
|
-
describe Pickle::Parser do
|
4
|
-
before do
|
5
|
-
@parser = Pickle::Parser.new(:config => Pickle::Config.new)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should raise error when created with no config" do
|
9
|
-
lambda{ Pickle::Parser.new }.should raise_error(ArgumentError)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'misc regexps' do
|
13
|
-
describe '/^#{capture_model} exists/' do
|
14
|
-
before do
|
15
|
-
@regexp = /^(#{@parser.capture_model}) exists$/
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should match 'a user exists'" do
|
19
|
-
'a user exists'.should match(@regexp)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should caputure 'a user' from 'a user exists'" do
|
23
|
-
'a user exists'.match(@regexp)[1].should == 'a user'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#parse_field' do
|
29
|
-
it "should return {'a' => 'b'} for 'a: \"b\"'" do
|
30
|
-
@parser.parse_field('a: "b"').should == {'a' => 'b'}
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should raise error for invalid field 'a : b'" do
|
34
|
-
lambda { @parser.parse_field('a : b') }.should raise_error(ArgumentError)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#parse_fields' do
|
39
|
-
it 'should return {} for blank argument' do
|
40
|
-
@parser.parse_fields(nil).should == {}
|
41
|
-
@parser.parse_fields('').should == {}
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should raise error for invalid argument' do
|
45
|
-
lambda { @parser.parse_fields('foo foo') }.should raise_error(ArgumentError)
|
46
|
-
end
|
47
|
-
|
48
|
-
it '(\'foo: "bar"\') should == { "foo" => "bar"}' do
|
49
|
-
@parser.parse_fields('foo: "bar"').should == { "foo" => "bar"}
|
50
|
-
end
|
51
|
-
|
52
|
-
it '("bool: true") should == { "bool" => true}' do
|
53
|
-
@parser.parse_fields('bool: true').should == {"bool" => true}
|
54
|
-
end
|
55
|
-
|
56
|
-
it '("bool: false") should == { "bool" => false}' do
|
57
|
-
@parser.parse_fields('bool: false').should == {"bool" => false}
|
58
|
-
end
|
59
|
-
|
60
|
-
it '("int: 10") should == { "int" => 10 }' do
|
61
|
-
@parser.parse_fields('int: 10').should == {"int" => 10}
|
62
|
-
end
|
63
|
-
|
64
|
-
it '("float: 10.1") should == { "float" => 10.1 }' do
|
65
|
-
@parser.parse_fields('float: 10.1').should == {"float" => 10.1}
|
66
|
-
end
|
67
|
-
|
68
|
-
it '(\'foo: "bar", bar_man: "wonga wonga", gump: 123\') should == {"foo" => "bar", "bar_man" => "wonga wonga", "gump" => 123}' do
|
69
|
-
@parser.parse_fields('foo: "bar", bar_man: "wonga wonga", gump: 123').should == {"foo" => "bar", "bar_man" => "wonga wonga", "gump" => 123}
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#parse_model' do
|
74
|
-
it '("a user") should == ["user", ""]' do
|
75
|
-
@parser.parse_model("a user").should == ["user", ""]
|
76
|
-
end
|
77
|
-
|
78
|
-
it '("the user") should == ["user", ""]' do
|
79
|
-
@parser.parse_model("the user").should == ["user", ""]
|
80
|
-
end
|
81
|
-
|
82
|
-
it '("1 fast car") should == ["fast_car", ""]' do
|
83
|
-
@parser.parse_model("1 fast car").should == ["fast_car", ""]
|
84
|
-
end
|
85
|
-
|
86
|
-
it '(\'an user: "jim jones"\') should == ["user", "jim_jones"]' do
|
87
|
-
@parser.parse_model('an user: "jim jones"').should == ["user", "jim_jones"]
|
88
|
-
end
|
89
|
-
|
90
|
-
it '(\'that fast car: "herbie"\') should == ["fast_car", "herbie"]' do
|
91
|
-
@parser.parse_model('that fast car: "herbie"').should == ["fast_car", "herbie"]
|
92
|
-
end
|
93
|
-
|
94
|
-
it '(\'the 12th user\') should == ["user", 11]' do
|
95
|
-
@parser.parse_model('the 12th user').should == ["user", 11]
|
96
|
-
end
|
97
|
-
|
98
|
-
it '(\'the last user\') should == ["user", -1]' do
|
99
|
-
@parser.parse_model('the last user').should == ["user", -1]
|
100
|
-
end
|
101
|
-
|
102
|
-
it '("the first user") should == ["user", 0]' do
|
103
|
-
@parser.parse_model('the first user').should == ["user", 0]
|
104
|
-
end
|
105
|
-
|
106
|
-
it '("the 1st user") should == ["user", 0]' do
|
107
|
-
@parser.parse_model('the 1st user').should == ["user", 0]
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "#parse_index" do
|
112
|
-
it '("1st") should == 0' do
|
113
|
-
@parser.parse_index("1st").should == 0
|
114
|
-
end
|
115
|
-
|
116
|
-
it '("24th") should == 23' do
|
117
|
-
@parser.parse_index("24th").should == 23
|
118
|
-
end
|
119
|
-
it '("first") should == 0' do
|
120
|
-
@parser.parse_index("first").should == 0
|
121
|
-
end
|
122
|
-
|
123
|
-
it '("last") should == -1' do
|
124
|
-
@parser.parse_index("last").should == -1
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "customised mappings" do
|
129
|
-
describe "config maps 'I|myself' to 'user: \"me\"'" do
|
130
|
-
before do
|
131
|
-
@config = Pickle::Config.new do |c|
|
132
|
-
c.map 'I', 'myself', :to => 'user: "me"'
|
133
|
-
end
|
134
|
-
@parser = Pickle::Parser.new(:config => @config)
|
135
|
-
end
|
136
|
-
|
137
|
-
it "'I' should match /\#{match_model}/" do
|
138
|
-
'I'.should match(/#{@parser.match_model}/)
|
139
|
-
end
|
140
|
-
|
141
|
-
it "'myself' should match /\#{match_model}/" do
|
142
|
-
'myself'.should match(/#{@parser.match_model}/)
|
143
|
-
end
|
144
|
-
|
145
|
-
it "parse_model('I') should == ['user', 'me']" do
|
146
|
-
@parser.parse_model('I').should == ["user", "me"]
|
147
|
-
end
|
148
|
-
|
149
|
-
it "parse_model('myself') should == ['user', 'me']" do
|
150
|
-
@parser.parse_model('myself').should == ["user", "me"]
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|