pickle-has_many_support 0.3.1

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.
Files changed (70) hide show
  1. data/.gitignore +5 -0
  2. data/History.txt +331 -0
  3. data/License.txt +20 -0
  4. data/README.rdoc +299 -0
  5. data/Rakefile +20 -0
  6. data/Rakefile.d/cucumber.rake +24 -0
  7. data/Rakefile.d/jeweller.rake +19 -0
  8. data/Rakefile.d/rcov.rake +18 -0
  9. data/Rakefile.d/rspec.rake +7 -0
  10. data/Rakefile.d/yard.rake +5 -0
  11. data/Todo.txt +3 -0
  12. data/VERSION +1 -0
  13. data/features/app/app.rb +122 -0
  14. data/features/app/blueprints.rb +11 -0
  15. data/features/app/factories.rb +23 -0
  16. data/features/app/views/notifier/email.erb +1 -0
  17. data/features/app/views/notifier/user_email.erb +6 -0
  18. data/features/email/email.feature +64 -0
  19. data/features/generator/generators.feature +59 -0
  20. data/features/path/models_page.feature +44 -0
  21. data/features/path/named_route_page.feature +10 -0
  22. data/features/pickle/create_from_active_record.feature +76 -0
  23. data/features/pickle/create_from_factory_girl.feature +59 -0
  24. data/features/pickle/create_from_machinist.feature +39 -0
  25. data/features/step_definitions/email_steps.rb +63 -0
  26. data/features/step_definitions/extra_email_steps.rb +7 -0
  27. data/features/step_definitions/fork_steps.rb +4 -0
  28. data/features/step_definitions/generator_steps.rb +46 -0
  29. data/features/step_definitions/path_steps.rb +14 -0
  30. data/features/step_definitions/pickle_steps.rb +100 -0
  31. data/features/support/email.rb +21 -0
  32. data/features/support/env.rb +52 -0
  33. data/features/support/paths.rb +47 -0
  34. data/features/support/pickle.rb +26 -0
  35. data/features/support/pickle_app.rb +4 -0
  36. data/init.rb +0 -0
  37. data/lib/pickle/adapter.rb +127 -0
  38. data/lib/pickle/adapters/active_record.rb +46 -0
  39. data/lib/pickle/adapters/data_mapper.rb +37 -0
  40. data/lib/pickle/config.rb +48 -0
  41. data/lib/pickle/email/parser.rb +18 -0
  42. data/lib/pickle/email/world.rb +13 -0
  43. data/lib/pickle/email.rb +79 -0
  44. data/lib/pickle/parser/matchers.rb +95 -0
  45. data/lib/pickle/parser.rb +71 -0
  46. data/lib/pickle/path/world.rb +5 -0
  47. data/lib/pickle/path.rb +45 -0
  48. data/lib/pickle/session/parser.rb +34 -0
  49. data/lib/pickle/session.rb +195 -0
  50. data/lib/pickle/version.rb +9 -0
  51. data/lib/pickle/world.rb +13 -0
  52. data/lib/pickle.rb +26 -0
  53. data/pickle.gemspec +117 -0
  54. data/rails_generators/pickle/pickle_generator.rb +33 -0
  55. data/rails_generators/pickle/templates/email.rb +21 -0
  56. data/rails_generators/pickle/templates/email_steps.rb +63 -0
  57. data/rails_generators/pickle/templates/paths.rb +47 -0
  58. data/rails_generators/pickle/templates/pickle.rb +28 -0
  59. data/rails_generators/pickle/templates/pickle_steps.rb +100 -0
  60. data/spec/pickle/adapter_spec.rb +163 -0
  61. data/spec/pickle/config_spec.rb +105 -0
  62. data/spec/pickle/email/parser_spec.rb +51 -0
  63. data/spec/pickle/email_spec.rb +160 -0
  64. data/spec/pickle/parser/matchers_spec.rb +74 -0
  65. data/spec/pickle/parser_spec.rb +165 -0
  66. data/spec/pickle/path_spec.rb +101 -0
  67. data/spec/pickle/session_spec.rb +451 -0
  68. data/spec/pickle_spec.rb +24 -0
  69. data/spec/spec_helper.rb +8 -0
  70. metadata +144 -0
@@ -0,0 +1,19 @@
1
+ require 'jeweler'
2
+ require 'pickle/version'
3
+
4
+ Jeweler::Tasks.new do |s|
5
+ s.name = "pickle"
6
+ s.version = Pickle::Version::String
7
+ s.summary = "Easy model creation and reference in your cucumber features"
8
+ s.description = "Easy model creation and reference in your cucumber features"
9
+ s.email = "ian.w.white@gmail.com"
10
+ s.homepage = "http://github.com/ianwhite/pickle/tree"
11
+ s.authors = ["Ian White"]
12
+ end
13
+
14
+ Jeweler::GemcutterTasks.new
15
+
16
+ namespace :release do
17
+ desc "release to github and gemcutter"
18
+ task :all => ['release', 'gemcutter:release']
19
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec/rake/spectask'
2
+ require 'spec/rake/verify_rcov'
3
+
4
+ desc "Generate RCov report"
5
+ Spec::Rake::SpecTask.new(:rcov) do |t|
6
+ t.spec_files = FileList['spec/**/*_spec.rb']
7
+ t.rcov = true
8
+ t.rcov_dir = 'doc/coverage'
9
+ t.rcov_opts = ['--text-report', '--exclude', "gems/,features/,/Library,spec/,rcov.rb"]
10
+ end
11
+
12
+ namespace :rcov do
13
+ desc "Verify RCov threshold"
14
+ RCov::VerifyTask.new(:verify => :rcov) do |t|
15
+ t.threshold = 98.12
16
+ t.index_html = 'doc/coverage/index.html'
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec/rake/spectask'
2
+
3
+ desc "Run the specs"
4
+ Spec::Rake::SpecTask.new(:spec) do |t|
5
+ t.spec_files = FileList['spec/**/*_spec.rb']
6
+ t.spec_opts = ["--colour"]
7
+ end
@@ -0,0 +1,5 @@
1
+ require 'yard'
2
+
3
+ YARD::Rake::YardocTask.new(:doc) do |t|
4
+ t.files = ['lib/**/*.rb', 'rails_generators/**/*.rb']
5
+ end
data/Todo.txt ADDED
@@ -0,0 +1,3 @@
1
+ * add 'scope' steps see http://gist.github.com/239570
2
+ * cleanup path_to_pickle and paths.rb (maybe have poly_pickle_path with same semantics as polymorphic_path, but accepting pickle refs)
3
+ * Translations
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,122 @@
1
+ # Routes
2
+ ActionController::Routing::Routes.draw do |map|
3
+ map.resources :spoons, :controller => 'default'
4
+ map.resources :forks, :controller => 'default' do |fork|
5
+ fork.resources :tines, :controller => 'default' do |tine|
6
+ tine.resources :comments, :controller => 'default'
7
+ end
8
+ end
9
+ map.resources :users, :controller => 'default'
10
+ end
11
+
12
+ # Migrations
13
+ ActiveRecord::Migration.suppress_messages do
14
+ ActiveRecord::Schema.define(:version => 0) do
15
+ create_table :forks, :force => true do |t|
16
+ t.string :name
17
+ end
18
+
19
+ create_table :spoons, :force => true do |t|
20
+ t.string :name
21
+ t.boolean :round, :default => true, :null => false
22
+ end
23
+
24
+ create_table :tines, :force => true do |t|
25
+ t.belongs_to :fork
26
+ t.boolean :rusty, :default => false, :null => false
27
+ end
28
+
29
+ create_table :users, :force => true do |t|
30
+ t.string :name, :status, :email
31
+ t.decimal :attitude_score, :precision => 4, :scale => 2
32
+ t.boolean :has_stale_password, :default => false
33
+ end
34
+ end
35
+ end
36
+
37
+
38
+ # Factories for these Fork & Spoon
39
+ class Fork < ActiveRecord::Base
40
+ validates_presence_of :name
41
+ has_many :tines
42
+
43
+ def completely_rusty?
44
+ tines.map(&:rusty?).uniq == [true]
45
+ end
46
+
47
+ def fancy?
48
+ name =~ /fancy/i
49
+ end
50
+ end
51
+
52
+ class Tine < ActiveRecord::Base
53
+ validates_presence_of :fork
54
+ belongs_to :fork
55
+ end
56
+
57
+ # Machinist blueprint for this
58
+ class Spoon < ActiveRecord::Base
59
+ validates_presence_of :name
60
+ end
61
+
62
+ # we don't want abstract classes getting in there
63
+ class AbstractUser < ActiveRecord::Base
64
+ self.abstract_class = true
65
+ end
66
+
67
+ # No factory or blueprint for this
68
+ class User < AbstractUser
69
+ validates_presence_of :name
70
+
71
+ def positive_person?
72
+ !no_attitude? && attitude_score > 0
73
+ end
74
+
75
+ def no_attitude?
76
+ attitude_score.nil?
77
+ end
78
+ end
79
+
80
+ # controllers
81
+ class DefaultController < ActionController::Base
82
+ def index
83
+ render :text => "index: I was invoked with #{request.path}"
84
+ end
85
+
86
+ def show
87
+ render :text => "show: I was invoked with #{request.path}"
88
+ end
89
+
90
+ def new
91
+ render :text => "new: I was invoked with #{request.path}"
92
+ end
93
+
94
+ def edit
95
+ render :text => "edit: I was invoked with #{request.path}"
96
+ end
97
+ end
98
+
99
+ # notifiers
100
+ class Notifier < ActionMailer::Base
101
+ include ActionController::UrlWriter
102
+
103
+ # BC 2.1
104
+ if respond_to?(:view_paths)
105
+ view_paths << "#{File.dirname(__FILE__)}/views"
106
+ else
107
+ self.template_root = "#{File.dirname(__FILE__)}/views"
108
+ end
109
+
110
+ def user_email(user)
111
+ @recipients = user.email
112
+ @subject = 'A user email'
113
+ @body[:user] = user
114
+ @body[:path] = user_path(user)
115
+ end
116
+
117
+ def email(to, subject, body)
118
+ @recipients = to
119
+ @subject = subject
120
+ @body[:body] = body
121
+ end
122
+ end
@@ -0,0 +1,11 @@
1
+ # Blueprints
2
+ require 'machinist/active_record'
3
+
4
+ Sham.spoon_name { |i| "Spoon #{i}" }
5
+
6
+ Spoon.blueprint do
7
+ name { Sham.spoon_name }
8
+ end
9
+
10
+ # reset shams between scenarios
11
+ Before { Sham.reset }
@@ -0,0 +1,23 @@
1
+ # Factories
2
+ require 'factory_girl'
3
+
4
+ Factory.sequence :fork_name do |n|
5
+ "fork %d04" % n
6
+ end
7
+
8
+ Factory.define :fork do |f|
9
+ f.name { Factory.next(:fork_name) }
10
+ end
11
+
12
+ Factory.define :tine do |t|
13
+ t.association :fork
14
+ end
15
+
16
+ Factory.define :rusty_tine, :class => Tine do |t|
17
+ t.association :fork
18
+ t.rusty true
19
+ end
20
+
21
+ Factory.define :fancy_fork, :class => Fork do |t|
22
+ t.name { "Fancy " + Factory.next(:fork_name) }
23
+ end
@@ -0,0 +1 @@
1
+ <%= @body %>
@@ -0,0 +1,6 @@
1
+ Dear <%= @user.name %>,
2
+
3
+ This is where you should go: <%= @path %>
4
+
5
+ Cheers,
6
+ The Pickle Team
@@ -0,0 +1,64 @@
1
+ Feature: I can test emails are sent
2
+ In order write features with emails as outcomes
3
+ As a feature writer
4
+ I want to easily see what emails have been delivered
5
+
6
+ Scenario: Deliver an email, and test it's properties
7
+ Given an email "Gday" with body: "Gday Mate" is delivered to fred@gmail.com
8
+ Then 1 email should be delivered
9
+ And the email should not be delivered to "frood@fmail.com"
10
+ And the email should have subject: "Gday", to: "fred@gmail.com"
11
+ And the email should contain "Mate"
12
+ And the email should not contain "Foo"
13
+
14
+ Scenario: Deliver some emails, restrict scope
15
+ Given an email "cool" with body: "body1" is delivered to fred@gmail.com
16
+ And an email "tasty" with body: "body2" is delivered to fred@gmail.com
17
+ And an email "cool" with body: "body3" is delivered to joe@gmail.com
18
+
19
+ Then 2 emails should be delivered to fred@gmail.com
20
+ And the 1st email should have subject: "cool"
21
+ And the 2nd email should have subject: "tasty"
22
+
23
+ And 2 emails should be delivered with subject: "cool"
24
+ And the 1st email should be delivered to fred@gmail.com
25
+ And the 2nd email should be delivered to joe@gmail.com
26
+
27
+ And 1 email should be delivered with subject: "cool", to: "fred@gmail.com"
28
+
29
+ Scenario: Deliver some emails, reset deliveries
30
+ Given an email "cool" with body: "body1" is delivered to fred@gmail.com
31
+ And all emails have been delivered
32
+ Then 0 emails should be delivered
33
+
34
+ Scenario: Deliver emails to user
35
+ Given a user exists with name: "Fred", email: "fred@gmail.com"
36
+ And the user's email is delivered
37
+ Then 1 email should be delivered to the user
38
+ And the email should contain "Dear Fred"
39
+ And the email should link to the user's page
40
+
41
+ Scenario: Following the first link in an email
42
+ Given a user exists with name: "Fred", email: "fred@gmail.com"
43
+ And an email "cool" with body: "some text <a href='http://example.com/users/1'>example page</a> more text" is delivered to fred@gmail.com
44
+ Then 1 email should be delivered to the user
45
+ And I click the first link in the email
46
+ Then I should be at the user's page
47
+
48
+ Scenario: Following a link in an email by url
49
+ Given a user exists with name: "Fred", email: "fred@gmail.com"
50
+ And an email "cool" with body: "some text <a href='http://example.com/users/1'>example page</a> more text" is delivered to fred@gmail.com
51
+ Then 1 email should be delivered to the user
52
+ And I follow "example.com/" in the email
53
+ Then I should be at the user's page
54
+
55
+ Scenario: Following a link in an email by the text
56
+ Given a user exists with name: "Fred", email: "fred@gmail.com"
57
+ And an email "cool" with body: "some text <a href='http://example.com/users/1'>example page</a> more text" is delivered to fred@gmail.com
58
+ Then 1 email should be delivered to the user
59
+ And I follow "example page" in the email
60
+ Then I should be at the user's page
61
+
62
+ Scenario: Save and open email
63
+ Given an email "Gday" with body: "Gday Mate" is delivered to fred@gmail.com
64
+ Then show me the email
@@ -0,0 +1,59 @@
1
+ @gen
2
+ Feature: allow pickle to generate steps
3
+ In order to get going with pickle
4
+ As a dev
5
+ I want to be able to generate steps
6
+
7
+ Scenario: script/generate pickle on fresh cuke install
8
+ Given cucumber has been freshly generated
9
+ When I run "script/generate pickle -f"
10
+ Then the file features/support/pickle.rb should exist
11
+ And the file features/support/pickle.rb should match /require 'pickle\/world'/
12
+ And the file features/step_definitions/pickle_steps.rb should be identical to the local step_definitions/pickle_steps.rb
13
+
14
+ Scenario: script/generate pickle path on fresh cuke install
15
+ Given cucumber has been freshly generated
16
+ When I run "script/generate pickle path -f"
17
+ Then the file features/support/pickle.rb should exist
18
+ And the file features/support/pickle.rb should match /require 'pickle\/world'/
19
+ And the file features/support/pickle.rb should match /require 'pickle\/path\/world'/
20
+ And the file features/step_definitions/pickle_steps.rb should be identical to the local step_definitions/pickle_steps.rb
21
+ And the file features/support/paths.rb should be identical to the local support/paths.rb
22
+
23
+ Scenario: script/generate pickle email on fresh cuke install
24
+ Given cucumber has been freshly generated
25
+ When I run "script/generate pickle email -f"
26
+ Then the file features/support/pickle.rb should exist
27
+ And the file features/support/pickle.rb should match /require 'pickle\/world'/
28
+ And the file features/support/pickle.rb should match /require 'pickle\/email\/world'/
29
+ And the file features/step_definitions/pickle_steps.rb should be identical to the local step_definitions/pickle_steps.rb
30
+ And the file features/step_definitions/email_steps.rb should be identical to the local step_definitions/email_steps.rb
31
+ And the file features/support/email.rb should be identical to the local support/email.rb
32
+
33
+ Scenario: script/generate pickle path email on fresh cuke install
34
+ Given cucumber has been freshly generated
35
+ When I run "script/generate pickle path email -f"
36
+ Then the file features/support/pickle.rb should exist
37
+ And the file features/support/pickle.rb should be identical to the local support/pickle.rb
38
+ And the file features/support/pickle.rb should match /require 'pickle\/world'/
39
+ And the file features/support/pickle.rb should match /require 'pickle\/path\/world'/
40
+ And the file features/support/pickle.rb should match /require 'pickle\/email\/world'/
41
+ And the file features/step_definitions/pickle_steps.rb should be identical to the local step_definitions/pickle_steps.rb
42
+ And the file features/support/paths.rb should be identical to the local support/paths.rb
43
+ And the file features/step_definitions/email_steps.rb should be identical to the local step_definitions/email_steps.rb
44
+ And the file features/support/email.rb should be identical to the local support/email.rb
45
+
46
+ Scenario: regenerating pickle
47
+ Given cucumber has been freshly generated
48
+ And pickle path email has been freshly generated
49
+ When I run "script/generate pickle path email -f"
50
+ Then the file features/support/pickle.rb should match /require 'pickle\/world'/
51
+ And the file features/support/pickle.rb should match /require 'pickle\/path\/world'/
52
+ And the file features/support/pickle.rb should match /require 'pickle\/email\/world'/
53
+ And the file features/step_definitions/pickle_steps.rb should be identical to the local step_definitions/pickle_steps.rb
54
+ And the file features/support/paths.rb should be identical to the local support/paths.rb
55
+ And the file features/step_definitions/email_steps.rb should be identical to the local step_definitions/email_steps.rb
56
+ But the file features/support/pickle.rb should not match /require 'pickle\/world'.*require 'pickle\/world'/
57
+ And the file features/support/pickle.rb should not match /require 'pickle\/path\/world'.*require 'pickle\/path\/world'/
58
+ And the file features/support/pickle.rb should not match /require 'pickle\/email\/world'.*require 'pickle\/email\/world'/
59
+ And the file features/support/email.rb should be identical to the local support/email.rb
@@ -0,0 +1,44 @@
1
+ Feature: I can visit a page for a model
2
+ In order to easily go to pages for models I've created
3
+ As a feature writer
4
+ I want to be able visit pages their model
5
+
6
+ Scenario: create a spoon, go its page
7
+ Given a spoon exists
8
+ When I go to the spoon's page
9
+ Then I should be at the spoon's page
10
+ And the spoon's page should match route /spoons/:id
11
+
12
+ Scenario: create a spoon, go to its edit page, check lots of different refs to it
13
+ Given a spoon: "fred" exists
14
+ When I go to spoon: "fred"'s edit page
15
+ Then I should be at the 1st spoon's edit page
16
+ And the 1st spoon's edit page should match route /spoons/:id/edit
17
+ And the spoon's edit page should match route /spoons/:id/edit
18
+ And the spoon: "fred"'s edit page should match route /spoons/:id/edit
19
+
20
+ Scenario: go to a fork's nested tines page
21
+ Given a fork exists
22
+ When I go to the fork's tines page
23
+ Then I should be at the fork's tines page
24
+ And the fork's tines page should match route /forks/:fork_id/tines
25
+
26
+ Scenario: go to a fork's new tine page
27
+ Given a fork exists
28
+ When I go to the fork's new tine page
29
+ Then I should be at the fork's new tine page
30
+ And the fork's new tine page should match route /forks/:fork_id/tines/new
31
+
32
+ Scenario: go to a tine in fork context page
33
+ Given a fork exists
34
+ And a tine exists with fork: the fork
35
+ When I go to the fork's tine's page
36
+ Then I should be at the fork's tine's page
37
+ And the fork's tine's page should match route /forks/:fork_id/tines/:id
38
+
39
+ Scenario: go to a tine's comments in fork context
40
+ Given a fork exists
41
+ And a tine exists with fork: the fork
42
+ When I go to the fork's tine's comments page
43
+ Then I should be at the fork's tine's comments page
44
+ And the fork's tine's comments page should match route /forks/:fork_id/tines/:tine_id/comments
@@ -0,0 +1,10 @@
1
+ Feature: I can visit a page by named route
2
+ In order to nav in my features
3
+ As a feature writer
4
+ I want to be able visit named routes
5
+
6
+ Scenario: visit the new spoons page
7
+ When I go to the new spoon page
8
+ Then I should be at the new spoon page
9
+ And the new spoon page should match route /spoons/new
10
+
@@ -0,0 +1,76 @@
1
+ Feature: I can easily create models from my blueprints
2
+
3
+ As a plain old AR user
4
+ I want to be able to create models with fields
5
+ So that I can create models quickly and easily in my features
6
+
7
+ @wip
8
+ Scenario: I create a user, and see if it looks right
9
+ Given a user exists with name: "Fred", has_stale_password: true
10
+ Then the user should not have a status
11
+ And the user should have a stale password
12
+ And the user's name should be "Fred"
13
+
14
+ Scenario: I create a user, and see if it looks right
15
+ Given a user exists with name: "Fred", status: "crayzee"
16
+ Then a user should exist with name: "Fred"
17
+ And a user should exist with status: "crayzee"
18
+ But a user should not exist with name: "Wilma"
19
+
20
+ Scenario: I create a user via a mapping
21
+ Given I exist with status: "pwned", name: "fred"
22
+ Then I should have a status
23
+ And the user: "me" should have a status
24
+
25
+ Scenario: I create positive and negative users
26
+ Given a user exists with name: "Fred", attitude_score: +5.42
27
+ And another user exists with name: "Ethel", attitude_score: -10
28
+ And another user exists with name: "Buddha", attitude_score: 2_000_000
29
+ Then 3 users should exist
30
+ And the 1st user should be a positive person
31
+ And the 2nd user should not be a positive person
32
+ And the 1st user's attitude_score should be 5.42
33
+ And the 2nd user's attitude_score should be -10
34
+ And the 3rd user's attitude_score should be 2_000_000
35
+ And the 3rd user's attitude_score should be 2000000
36
+
37
+ Scenario: I create nil values
38
+ Given a user exists with name: "Fred", attitude_score: nil
39
+ Then 1 users should exist with attitude_score: nil
40
+ And that user should be the first user
41
+ And that user should have no attitude
42
+ And that user's attitude_score should be nil
43
+
44
+ Scenario: create and find using tables
45
+ Given the following users exist:
46
+ | name | status |
47
+ | Jim | married |
48
+ | Ethel | in a relationship with x |
49
+ Then the following users should exist:
50
+ | name |
51
+ | Jim |
52
+ | Ethel |
53
+ And the following users should exist:
54
+ | status |
55
+ | married |
56
+ | in a relationship with x |
57
+ And the 1st user should be the 3rd user
58
+ And the 2nd user should be the last user
59
+
60
+ Scenario: create and find using tables with referencable names
61
+ Given the following users exist:
62
+ | user | name | status |
63
+ | Jack | Jack | alone |
64
+ | Pete | Pete | dead |
65
+ Then the following users should exist:
66
+ | name |
67
+ | Jack |
68
+ | Pete |
69
+ And the following users should exist:
70
+ | user | status |
71
+ | lonely | alone |
72
+ | rotting | dead |
73
+ And the 1st user should be the user: "Jack"
74
+ And the 2nd user should be the user: "Pete"
75
+ And the user: "lonely" should be the user: "Jack"
76
+ And the user: "rotting" should be the user: "Pete"
@@ -0,0 +1,59 @@
1
+ Feature: I can easily create models from my factories
2
+
3
+ As a pickle user
4
+ I want to be able to leverage my factories
5
+ So that I can create models quickly and easily in my features
6
+
7
+ Scenario: I create a fork, and see if it looks right
8
+ Given a fork exists
9
+ Then the fork should not be completely rusty
10
+
11
+ Scenario: I create a fork, and see if it looks right
12
+ Given a fork exists with name: "Forky"
13
+ Then a fork should exist with name: "Forky"
14
+ And the fork should not be completely rusty
15
+
16
+ Scenario: I create some forks, and some tines
17
+ Given a fork: "one" exists
18
+ And a tine exists with fork: fork "one"
19
+ And another tine exists with fork: fork "one"
20
+
21
+ And a fancy fork exists
22
+ And a tine exists with fork: the fancy fork
23
+
24
+ Then the first tine should be tine of the fork: "one"
25
+ And the 2nd tine should be tine of fork: "one"
26
+ And the last tine should be tine of the fancy fork
27
+
28
+ Then the first tine should be in fork "one"'s tines
29
+ And the 2nd tine should be in fork: "one"'s tines
30
+ And the last tine should be in the fancy fork's tines
31
+ And the fancy fork should be the last tine's fork
32
+
33
+ But the first tine should not be in the fancy fork's tines
34
+ And the last tine should not be in fork "one"'s tines
35
+ And the fancy fork should not be the first tine's fork
36
+
37
+ Scenario: I create a fork with a tine, and find the tine by the fork
38
+ Given a fork exists
39
+ And a tine exists with fork: the fork
40
+
41
+ Then a tine should exist with fork: the fork
42
+
43
+ Scenario: create a tine with fork refs in a table
44
+ Given 2 forks exist
45
+ And the following tines exist:
46
+ | fork |
47
+ | the 1st fork |
48
+ | the 2nd fork |
49
+ | the 2nd fork |
50
+ Then the 1st tine should be in the 1st fork's tines
51
+ And the 2nd tine should be in the 2nd fork's tines
52
+ And the 3rd tine should be in the 2nd fork's tines
53
+ And the 1st fork should have 1 tines
54
+ And the 2nd fork should have 2 tines
55
+
56
+ Scenario: I create fork via a mapping
57
+ Given killah fork exists
58
+ Then the fork should be fancy
59
+ And the fancy fork: "of cornwood" should be fancy
@@ -0,0 +1,39 @@
1
+ Feature: I can easily create models from my blueprints
2
+
3
+ As a machinist user
4
+ I want to be able to leverage my blueprints
5
+ So that I can create models quickly and easily in my features
6
+
7
+ Scenario: I create a spoon, and see if it looks right
8
+ Given a spoon exists
9
+ Then the spoon should be round
10
+ And the spoon's round should be true
11
+
12
+ Scenario: I create a non round spoon, and see if it looks right
13
+ Given a spoon exists with round: false
14
+ Then the spoon should not be round
15
+
16
+ Scenario: I create a named spoon, and see if it has the name
17
+ Given a spoon exists with name: "Pete", round: false
18
+ Then a spoon should exist with name: "Pete"
19
+ And the spoon should not be round
20
+
21
+ Scenario: I create 7 spoons of various roundness
22
+ Given 2 spoons exist with round: false
23
+ And 2 spoons exist with round: true
24
+ And a spoon exists with round: false
25
+
26
+ Then the 1st spoon should not be round
27
+ And the 2nd spoon should not be round
28
+ And the 3rd spoon should be round
29
+ And the 4th spoon should be round
30
+ And the 5th spoon should not be round
31
+
32
+ And 3 spoons should exist with round: false
33
+ And the 1st spoon should not be round
34
+ And the 2nd spoon should not be round
35
+ And the last spoon should not be round
36
+
37
+ And 2 spoons should exist with round: true
38
+ And the first spoon should be round
39
+ And the last spoon should be round
@@ -0,0 +1,63 @@
1
+ # this file generated by script/generate pickle email
2
+ #
3
+ # add email mappings in features/support/email.rb
4
+
5
+ ActionMailer::Base.delivery_method = :test
6
+ ActionMailer::Base.perform_deliveries = true
7
+
8
+ Before do
9
+ ActionMailer::Base.deliveries.clear
10
+ end
11
+
12
+ # Clear the deliveries array, useful if your background sends email that you want to ignore
13
+ Given(/^all emails? (?:have|has) been delivered$/) do
14
+ ActionMailer::Base.deliveries.clear
15
+ end
16
+
17
+ Given(/^(\d)+ emails? should be delivered$/) do |count|
18
+ emails.size.should == count.to_i
19
+ end
20
+
21
+ When(/^(?:I|they) follow "([^"]*?)" in #{capture_email}$/) do |link, email_ref|
22
+ visit_in_email(email(email_ref), link)
23
+ end
24
+
25
+ When(/^(?:I|they) click the first link in #{capture_email}$/) do |email_ref|
26
+ click_first_link_in_email(email(email_ref))
27
+ end
28
+
29
+ Then(/^(\d)+ emails? should be delivered to (.*)$/) do |count, to|
30
+ emails("to: \"#{email_for(to)}\"").size.should == count.to_i
31
+ end
32
+
33
+ Then(/^(\d)+ emails? should be delivered with #{capture_fields}$/) do |count, fields|
34
+ emails(fields).size.should == count.to_i
35
+ end
36
+
37
+ Then(/^#{capture_email} should be delivered to (.+)$/) do |email_ref, to|
38
+ email(email_ref, "to: \"#{email_for(to)}\"").should_not be_nil
39
+ end
40
+
41
+ Then(/^#{capture_email} should not be delivered to (.+)$/) do |email_ref, to|
42
+ email(email_ref, "to: \"#{email_for(to)}\"").should be_nil
43
+ end
44
+
45
+ Then(/^#{capture_email} should have #{capture_fields}$/) do |email_ref, fields|
46
+ email(email_ref, fields).should_not be_nil
47
+ end
48
+
49
+ Then(/^#{capture_email} should contain "(.*)"$/) do |email_ref, text|
50
+ email(email_ref).body.should =~ /#{text}/
51
+ end
52
+
53
+ Then(/^#{capture_email} should not contain "(.*)"$/) do |email_ref, text|
54
+ email(email_ref).body.should_not =~ /#{text}/
55
+ end
56
+
57
+ Then(/^#{capture_email} should link to (.+)$/) do |email_ref, page|
58
+ email(email_ref).body.should =~ /#{path_to(page)}/
59
+ end
60
+
61
+ Then(/^show me the emails?$/) do
62
+ save_and_open_emails
63
+ end
@@ -0,0 +1,7 @@
1
+ Given(/^an email "(.*?)" with body: "(.*?)" is delivered to (.+?)$/) do |subject, body, to|
2
+ Notifier.deliver_email(to, subject, body)
3
+ end
4
+
5
+ Given(/^#{capture_model}'s email is delivered$/) do |model|
6
+ Notifier.deliver_user_email(model(model))
7
+ end
@@ -0,0 +1,4 @@
1
+ # example of making your own matcher with the pickle backend
2
+ Then(/^#{capture_model} should be tine of #{capture_model}$/) do |tine, fork|
3
+ model(fork).tines.should include(model(tine))
4
+ end