pickle 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock.development +24 -22
- data/History.txt +7 -0
- data/features/email/email.feature +3 -3
- data/features/pickle/create_from_factory_girl.feature +4 -1
- data/features/pickle/create_from_machinist.feature +8 -1
- data/features/step_definitions/extra_email_steps.rb +5 -0
- data/features/step_definitions/raise_error_steps.rb +6 -2
- data/features/support/env.rb +4 -47
- data/lib/pickle/session.rb +5 -2
- data/lib/pickle/version.rb +1 -1
- data/spec/pickle/session_spec.rb +1 -1
- metadata +4 -4
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.7)
|
5
5
|
cucumber (>= 0.8)
|
6
6
|
rake
|
7
7
|
|
@@ -47,29 +47,31 @@ GEM
|
|
47
47
|
selenium-webdriver (>= 0.0.27)
|
48
48
|
xpath (~> 0.1.3)
|
49
49
|
celerity (0.8.8)
|
50
|
-
childprocess (0.1.
|
51
|
-
ffi (~> 0.6
|
52
|
-
cucumber (0.10.
|
50
|
+
childprocess (0.1.8)
|
51
|
+
ffi (~> 1.0.6)
|
52
|
+
cucumber (0.10.2)
|
53
53
|
builder (>= 2.1.2)
|
54
|
-
diff-lcs (
|
55
|
-
gherkin (
|
56
|
-
json (
|
57
|
-
term-ansicolor (
|
58
|
-
cucumber-rails (0.
|
59
|
-
cucumber (>= 0.
|
54
|
+
diff-lcs (>= 1.1.2)
|
55
|
+
gherkin (>= 2.3.5)
|
56
|
+
json (>= 1.4.6)
|
57
|
+
term-ansicolor (>= 1.0.5)
|
58
|
+
cucumber-rails (0.4.0)
|
59
|
+
cucumber (>= 0.10.1)
|
60
|
+
nokogiri (>= 1.4.4)
|
61
|
+
rack-test (>= 0.5.7)
|
60
62
|
culerity (0.2.15)
|
61
|
-
database_cleaner (0.6.
|
63
|
+
database_cleaner (0.6.6)
|
62
64
|
diff-lcs (1.1.2)
|
63
65
|
erubis (2.6.6)
|
64
66
|
abstract (>= 1.0.0)
|
65
67
|
factory_girl (1.3.3)
|
66
|
-
ffi (0.
|
68
|
+
ffi (1.0.7)
|
67
69
|
rake (>= 0.8.7)
|
68
|
-
gherkin (2.3.
|
69
|
-
json (
|
70
|
+
gherkin (2.3.5)
|
71
|
+
json (>= 1.4.6)
|
70
72
|
git (1.2.5)
|
71
73
|
i18n (0.5.0)
|
72
|
-
json (1.
|
74
|
+
json (1.5.1)
|
73
75
|
json_pure (1.5.1)
|
74
76
|
machinist (1.0.6)
|
75
77
|
mail (2.2.15)
|
@@ -80,8 +82,8 @@ GEM
|
|
80
82
|
mime-types (1.16)
|
81
83
|
nokogiri (1.4.4)
|
82
84
|
polyglot (0.3.1)
|
83
|
-
rack (1.2.
|
84
|
-
rack-mount (0.6.
|
85
|
+
rack (1.2.2)
|
86
|
+
rack-mount (0.6.14)
|
85
87
|
rack (>= 1.0.0)
|
86
88
|
rack-test (0.5.7)
|
87
89
|
rack (>= 1.0)
|
@@ -114,9 +116,9 @@ GEM
|
|
114
116
|
railties (~> 3.0)
|
115
117
|
rspec (~> 2.5.0)
|
116
118
|
rubyzip (0.9.4)
|
117
|
-
selenium-webdriver (0.1.
|
118
|
-
childprocess (
|
119
|
-
ffi (
|
119
|
+
selenium-webdriver (0.1.4)
|
120
|
+
childprocess (>= 0.1.7)
|
121
|
+
ffi (>= 1.0.7)
|
120
122
|
json_pure
|
121
123
|
rubyzip
|
122
124
|
sqlite3 (1.3.3)
|
@@ -126,10 +128,10 @@ GEM
|
|
126
128
|
thor (0.14.6)
|
127
129
|
treetop (1.4.9)
|
128
130
|
polyglot (>= 0.3.1)
|
129
|
-
tzinfo (0.3.
|
131
|
+
tzinfo (0.3.25)
|
130
132
|
xpath (0.1.3)
|
131
133
|
nokogiri (~> 1.3)
|
132
|
-
yard (0.6.
|
134
|
+
yard (0.6.5)
|
133
135
|
|
134
136
|
PLATFORMS
|
135
137
|
ruby
|
data/History.txt
CHANGED
@@ -40,21 +40,21 @@ Feature: I can test emails are sent
|
|
40
40
|
|
41
41
|
Scenario: Following the first link in an email
|
42
42
|
Given a user exists with name: "Fred", email: "fred@gmail.com"
|
43
|
-
And an email
|
43
|
+
And an email with a link "example page" to the user's page is delivered to fred@gmail.com
|
44
44
|
Then 1 email should be delivered to the user
|
45
45
|
And I click the first link in the email
|
46
46
|
Then I should be at the user's page
|
47
47
|
|
48
48
|
Scenario: Following a link in an email by url
|
49
49
|
Given a user exists with name: "Fred", email: "fred@gmail.com"
|
50
|
-
|
50
|
+
And an email with a link "example page" to the user's page is delivered to fred@gmail.com
|
51
51
|
Then 1 email should be delivered to the user
|
52
52
|
And I follow "example.com/" in the email
|
53
53
|
Then I should be at the user's page
|
54
54
|
|
55
55
|
Scenario: Following a link in an email by the text
|
56
56
|
Given a user exists with name: "Fred", email: "fred@gmail.com"
|
57
|
-
And an email
|
57
|
+
And an email with a link "example page" to the user's page is delivered to fred@gmail.com
|
58
58
|
Then 1 email should be delivered to the user
|
59
59
|
And I follow "example page" in the email
|
60
60
|
Then I should be at the user's page
|
@@ -59,5 +59,8 @@ Feature: I can easily create models from my factories
|
|
59
59
|
And the fancy fork: "of cornwood" should be fancy
|
60
60
|
|
61
61
|
Scenario: create a tine with a missing fork
|
62
|
-
Then the following should raise Pickle::Session::ModelNotKnownError:
|
62
|
+
Then the following should raise a Pickle::Session::ModelNotKnownError:
|
63
|
+
"""
|
64
|
+
Given a tine exists with fork: the fork
|
65
|
+
"""
|
63
66
|
|
@@ -36,4 +36,11 @@ Feature: I can easily create models from my blueprints
|
|
36
36
|
|
37
37
|
And 2 spoons should exist with round: true
|
38
38
|
And the first spoon should be round
|
39
|
-
And the last spoon should be round
|
39
|
+
And the last spoon should be round
|
40
|
+
|
41
|
+
Scenario: ModelNotKnownError should be informative when failing to find
|
42
|
+
Given a spoon exists with round: true
|
43
|
+
Then the following should raise a Pickle::Session::ModelNotFoundError with "Can't find a spoon with round: false from the orm in this scenario":
|
44
|
+
"""
|
45
|
+
Then a spoon should exist with round: false
|
46
|
+
"""
|
@@ -2,6 +2,11 @@ Given(/^an email "(.*?)" with body: "(.*?)" is delivered to (.+?)$/) do |subject
|
|
2
2
|
Notifier.email(to, subject, body).deliver
|
3
3
|
end
|
4
4
|
|
5
|
+
Given(/^an email with a link "(.+?)" to (.+?) is delivered to (.+?)$/) do |text, page, to|
|
6
|
+
body = "some text <a href='http://example.com/#{path_to(page)}'>#{text}</a> more text"
|
7
|
+
Notifier.email(to, "example", body).deliver
|
8
|
+
end
|
9
|
+
|
5
10
|
Given(/^#{capture_model}'s email is delivered$/) do |model|
|
6
11
|
Notifier.user_email(model!(model)).deliver
|
7
12
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
-
Then /^the following should raise
|
2
|
-
lambda { steps step }.should raise_error(
|
1
|
+
Then /^the following should raise an? ([\w:]+):$/ do |error, step|
|
2
|
+
lambda { steps step }.should raise_error(error.constantize)
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^the following should raise an? ([\w:]+) with "([^"]*)":$/ do |error, message, step|
|
6
|
+
lambda { steps step }.should raise_error(error.constantize, message)
|
3
7
|
end
|
data/features/support/env.rb
CHANGED
@@ -5,53 +5,10 @@
|
|
5
5
|
# files.
|
6
6
|
|
7
7
|
ENV["RAILS_ENV"] ||= "test"
|
8
|
-
|
8
|
+
ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/../../cucumber_test_app')
|
9
9
|
|
10
|
-
require '
|
11
|
-
require 'cucumber/rails
|
12
|
-
require 'cucumber/rails/active_record'
|
13
|
-
require 'cucumber/web/tableish'
|
14
|
-
|
15
|
-
require 'capybara/rails'
|
16
|
-
require 'capybara/cucumber'
|
17
|
-
require 'capybara/session'
|
18
|
-
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
19
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
20
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
21
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
22
|
-
# steps to use the XPath syntax.
|
10
|
+
require 'capybara'
|
11
|
+
require 'cucumber/rails'
|
23
12
|
Capybara.default_selector = :css
|
24
|
-
|
25
|
-
# If you set this to false, any error raised from within your app will bubble
|
26
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
27
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
28
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
29
|
-
#
|
30
|
-
# If you set this to true, Rails will rescue all errors and render error
|
31
|
-
# pages, more or less in the same way your application would behave in the
|
32
|
-
# default production environment. It's not recommended to do this for all
|
33
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
34
13
|
ActionController::Base.allow_rescue = false
|
35
|
-
|
36
|
-
# If you set this to true, each scenario will run in a database transaction.
|
37
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
38
|
-
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
39
|
-
# tagging with @culerity or @javascript will also turn transactions off.
|
40
|
-
#
|
41
|
-
# If you set this to false, transactions will be off for all scenarios,
|
42
|
-
# regardless of whether you use @no-txn or not.
|
43
|
-
#
|
44
|
-
# Beware that turning transactions off will leave data in your database
|
45
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
46
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
47
|
-
# block that will explicitly put your database in a known state.
|
48
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
49
|
-
# How to clean your database when transactions are turned off. See
|
50
|
-
# http://github.com/bmabey/database_cleaner for more info.
|
51
|
-
if defined?(ActiveRecord::Base)
|
52
|
-
begin
|
53
|
-
require 'database_cleaner'
|
54
|
-
DatabaseCleaner.strategy = :truncation
|
55
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
56
|
-
end
|
57
|
-
end
|
14
|
+
DatabaseCleaner.strategy = :truncation
|
data/lib/pickle/session.rb
CHANGED
@@ -5,7 +5,7 @@ module Pickle
|
|
5
5
|
|
6
6
|
def initialize(name, message = nil)
|
7
7
|
@name = name
|
8
|
-
@message = message || "The model: '#{name}' is not known in this scenario. Use #create_model to create, or #find_model to find, and store a reference in this scenario."
|
8
|
+
@message = message.presence || "The model: '#{name}' is not known in this scenario. Use #create_model to create, or #find_model to find, and store a reference in this scenario."
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s
|
@@ -13,6 +13,9 @@ module Pickle
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
class ModelNotFoundError < RuntimeError
|
17
|
+
end
|
18
|
+
|
16
19
|
class << self
|
17
20
|
def included(world_class)
|
18
21
|
proxy_to_pickle_parser(world_class)
|
@@ -67,7 +70,7 @@ module Pickle
|
|
67
70
|
end
|
68
71
|
|
69
72
|
def find_model!(name, fields = nil)
|
70
|
-
find_model(name, fields) or raise
|
73
|
+
find_model(name, fields) or raise ModelNotFoundError, "Can't find #{name}#{" with #{fields}" if fields.present?} from the orm in this scenario"
|
71
74
|
end
|
72
75
|
|
73
76
|
def find_models(factory, fields = nil)
|
data/lib/pickle/version.rb
CHANGED
data/spec/pickle/session_spec.rb
CHANGED
@@ -253,7 +253,7 @@ describe Pickle::Session do
|
|
253
253
|
|
254
254
|
it "should call raise error if find_model returns nil" do
|
255
255
|
should_receive(:find_model).with('name', 'fields').and_return(nil)
|
256
|
-
lambda { find_model!('name', 'fields') }.should raise_error(Pickle::Session::
|
256
|
+
lambda { find_model!('name', 'fields') }.should raise_error(Pickle::Session::ModelNotFoundError)
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
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-03-
|
18
|
+
date: 2011-03-24 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|