kbaum-pickle 0.2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.gitignore +3 -0
  2. data/History.txt +239 -0
  3. data/License.txt +20 -0
  4. data/README.rdoc +246 -0
  5. data/Rakefile +110 -0
  6. data/Todo.txt +4 -0
  7. data/VERSION +1 -0
  8. data/features/app/app.rb +121 -0
  9. data/features/app/blueprints.rb +11 -0
  10. data/features/app/factories.rb +23 -0
  11. data/features/app/views/notifier/email.erb +1 -0
  12. data/features/app/views/notifier/user_email.erb +6 -0
  13. data/features/email/email.feature +39 -0
  14. data/features/generator/generators.feature +59 -0
  15. data/features/path/models_page.feature +44 -0
  16. data/features/path/named_route_page.feature +10 -0
  17. data/features/pickle/create_from_active_record.feature +49 -0
  18. data/features/pickle/create_from_factory_girl.feature +55 -0
  19. data/features/pickle/create_from_machinist.feature +38 -0
  20. data/features/step_definitions/email_steps.rb +55 -0
  21. data/features/step_definitions/extra_email_steps.rb +7 -0
  22. data/features/step_definitions/fork_steps.rb +4 -0
  23. data/features/step_definitions/generator_steps.rb +46 -0
  24. data/features/step_definitions/path_steps.rb +14 -0
  25. data/features/step_definitions/pickle_steps.rb +73 -0
  26. data/features/support/email.rb +21 -0
  27. data/features/support/env.rb +55 -0
  28. data/features/support/paths.rb +46 -0
  29. data/features/support/pickle.rb +26 -0
  30. data/features/support/pickle_app.rb +4 -0
  31. data/garlic.rb +38 -0
  32. data/init.rb +0 -0
  33. data/lib/pickle/adapter.rb +88 -0
  34. data/lib/pickle/config.rb +48 -0
  35. data/lib/pickle/email/parser.rb +18 -0
  36. data/lib/pickle/email/world.rb +13 -0
  37. data/lib/pickle/email.rb +36 -0
  38. data/lib/pickle/parser/matchers.rb +87 -0
  39. data/lib/pickle/parser.rb +65 -0
  40. data/lib/pickle/path/world.rb +5 -0
  41. data/lib/pickle/path.rb +45 -0
  42. data/lib/pickle/session/parser.rb +34 -0
  43. data/lib/pickle/session.rb +157 -0
  44. data/lib/pickle/version.rb +6 -0
  45. data/lib/pickle/world.rb +9 -0
  46. data/lib/pickle.rb +26 -0
  47. data/pickle.gemspec +110 -0
  48. data/rails_generators/pickle/pickle_generator.rb +40 -0
  49. data/rails_generators/pickle/templates/email.rb +21 -0
  50. data/rails_generators/pickle/templates/email_steps.rb +55 -0
  51. data/rails_generators/pickle/templates/paths.rb +20 -0
  52. data/rails_generators/pickle/templates/pickle.rb +28 -0
  53. data/rails_generators/pickle/templates/pickle_steps.rb +73 -0
  54. data/spec/lib/pickle_adapter_spec.rb +164 -0
  55. data/spec/lib/pickle_config_spec.rb +97 -0
  56. data/spec/lib/pickle_email_parser_spec.rb +49 -0
  57. data/spec/lib/pickle_email_spec.rb +131 -0
  58. data/spec/lib/pickle_parser_matchers_spec.rb +70 -0
  59. data/spec/lib/pickle_parser_spec.rb +154 -0
  60. data/spec/lib/pickle_path_spec.rb +92 -0
  61. data/spec/lib/pickle_session_spec.rb +384 -0
  62. data/spec/lib/pickle_spec.rb +24 -0
  63. data/spec/spec_helper.rb +38 -0
  64. metadata +126 -0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg
2
+ doc/*
3
+ .garlic
data/History.txt ADDED
@@ -0,0 +1,239 @@
1
+ == 0.2.1 - 1 Dec 2009
2
+
3
+ * 2 minor improvements
4
+ * Allow nil as field value [#14]
5
+ * Added negative email step for delivered to
6
+
7
+
8
+ == 0.2.0 - 24 Nov 2009
9
+
10
+ * 4 major improvements
11
+ * Added support for finding models using tables
12
+ Example:
13
+ Then the following users should exist:
14
+ | name |
15
+ | Fred |
16
+ | Ethel |
17
+ And the 1st user should be male
18
+ And the 2nd user should be female
19
+
20
+ * tables now support pickle refs in cells (see features/pickle/create_from_factory_girl.rb#37)
21
+
22
+ * features/support/email.rb adds an email helper for mapping names to email addresses (similar to NavigationHelper in paths.rb)
23
+
24
+ * Added ability for path_to_pickle to handle arbitrary segments
25
+ Example:
26
+ path_to_pickle('account', 'the enquiry') => account_enquiry_path(<enquiry>)
27
+
28
+ * 2 minor improvements
29
+ * fail faster in pickle steps when a pickle ref can't be found, by using model! in most places
30
+
31
+ * generated pickle steps are less picky about possessives so that pickle mappings accepted in more places
32
+ e.g. when you have
33
+ config.map 'my', 'I', 'myself', :to => 'user: "me"'
34
+ you can now do
35
+ Given I exist
36
+ ...
37
+ Then the project should be one of my assigned projects
38
+
39
+
40
+ == 0.1.23 - 22 Nov 2009
41
+
42
+ * 1 major improvement
43
+ * script/generate pickle now adds its own pickle.rb support file, making it easier to regenerate cucumber
44
+ when a new release of cucumber appears [schlick, ianwhite]
45
+
46
+ * 1 minor improvement
47
+ * docs: more links
48
+
49
+
50
+ == 0.1.22 - 7 Nov 2009
51
+
52
+ * 2 minor enhancements
53
+ * Improved docs to include instructions for FactoryGirl users, and links/resources for pickle users
54
+ * Ruby 1.9.1 compatibility changes
55
+
56
+
57
+ == 0.1.21
58
+
59
+ * 1 minor enhancement
60
+ * Added 'should not' steps corresponding to model existence, and association exitsence [schlick]
61
+
62
+
63
+ == 0.1.20
64
+
65
+ * 1 minor enhancement
66
+ * Pickle now matches numeric field values preceded with a positive and negative sign eg +1.5 and -1 [schlick]
67
+
68
+
69
+ == 0.1.19
70
+
71
+ * 1 minor enhancement
72
+ * Add support for Cucumber tables [Tobi Knaup]
73
+
74
+
75
+ == 0.1.16, 0.1.17, 0.1.18 - 13 Oct 2009
76
+
77
+ * 1 minor enhancement
78
+ * release gem on gemcutter and code on github
79
+
80
+
81
+ == 0.1.15 - 28 Aug 2009
82
+
83
+ * 1 minor enhancement
84
+ * avoid namespace collision on replace by renaming mapping#replace -> mapping#replacement [nruth]
85
+
86
+
87
+ == 0.1.14 - 9 July 2009
88
+
89
+ * 1 minor enhancement
90
+ * update specs and features for latest cucumber and machinist changes
91
+
92
+
93
+ == 0.1.13 - 16 June 2009
94
+
95
+ * 2 minor enhancements
96
+ * model! and created_model! raise an error if pickle name can't be found
97
+ * path_to_pickle uses the above to give back a better error message
98
+
99
+
100
+ == 0.1.12 - 7 Apr 2009
101
+
102
+ * 2 minor enhancements
103
+ * rationalised Rakefile
104
+ * update World extensions for latest cucumber changes
105
+
106
+
107
+ == 0.1.11 - 22 Feb 2009
108
+
109
+ * 2 minor enhancements
110
+ * Pickle now supports multiple machinist blueprints
111
+ * Fix confusing adapter/adaptor comment generator comment
112
+
113
+
114
+ == 0.1.10 - 13 Feb 2009
115
+
116
+ * 2 minor enhancements
117
+ * Made pickle paths generator compatible with latest cucumber
118
+ * Simplified and Rakefile, including auto push api docs to gh-pages on ci build
119
+
120
+
121
+ == 0.1.9 - 29 Jan 2009
122
+
123
+ * 1 minor enhancement
124
+ * Pickle::Adapter.model_classes excludes those without tables
125
+
126
+
127
+ == 0.1.8 - 29 Jan 2009
128
+
129
+ * API change
130
+ * pickle_path becomes path_to_pickle, to avoid named route clashes
131
+
132
+ * 2 minor enhancements
133
+ * Updated features for cucumber 0.2 compat
134
+ * Made paths allow for optional possesives
135
+
136
+
137
+ == 0,1,7
138
+
139
+ * 2 API changes
140
+ * script/generate pickle path[s] now amends the features/support/paths.rb file
141
+ instead of creating pge_to_path and path_steps.
142
+
143
+ * pickle_email_steps is renamed email_steps
144
+
145
+
146
+ == 0.1.6
147
+
148
+ * 1 API change
149
+ * to use pickle env.rb should contain "require 'pickle/world'". You should remove all trace of
150
+ pickle from features/support/env.rb and re run script/generate pickle
151
+
152
+ * 2 major enhancements
153
+
154
+ * generate email steps with `script/generate pickle email`
155
+ email steps allow you to do things like this:
156
+
157
+ Then 2 emails should be delivered
158
+ And the first email should be delivered to fred@gmail.com
159
+ And the 2nd email should be delivered to the user: "ethel"
160
+
161
+ Then 1 email should be delivered with subject: "Activate your account"
162
+ And the email should link to the user's page
163
+
164
+ take a look at features/step_definitions/pickle_email_steps.rb
165
+
166
+ * generate path steps with `script/generate pickle path`
167
+ path steps allow you to do things like this
168
+
169
+ When I go to the comment's page
170
+ Then I should be at the user's new comment page
171
+
172
+ take a look at features/step_definitions/pickle_path_steps.rb, and modify page_to_path to suit your needs
173
+
174
+ * 4 minor enhancements
175
+ * Improved documentation
176
+ * abstract models no longer kill pickle
177
+ * Actually test that the generators work
178
+ * Made Pickle::Session a plain ole mixin, as a separate class was unnecessary
179
+ * Pickle uses the cucumber World API
180
+
181
+
182
+ == 0.1.5
183
+
184
+ * API change
185
+ * CaptureModel, etc are now 'capture_model' methods
186
+
187
+ * 3 major enhancements
188
+ * Steps for asserting that <n> models exist, matching certain criteria
189
+ * Steps for asserting associations added to generated pickle steps
190
+ 'Then the user should be in the post's commenters'
191
+ 'Then the forum: "awesome" should be the 2nd post's forum'
192
+ * configuration can now occur any time before a step is defined, which makes
193
+ for much more intuitive env.rb
194
+
195
+ * 2 minor enhancement
196
+ * predicate matching is less prone to step conflicts because we preload a
197
+ big list of all the predicate and column methods
198
+ * field values now handle booleans and numerics
199
+
200
+
201
+ == 0.1.4
202
+
203
+ * 1 major enhancement
204
+ * You can create multiple models with ease, for eg.
205
+ 'Given 10 users exist with role: "admin"'
206
+
207
+ * 1 minor enhancement
208
+ * You can do Pickle.configure (just like Webrat.configure)
209
+
210
+
211
+ == 0.1.3 - Bugfix release
212
+
213
+ * 1 minor enhancement
214
+ * make generated steps compatible with Rails 2.1
215
+
216
+
217
+ == 0.1.2
218
+
219
+ * 2 major enhancements
220
+ * create your pickle steps with script/generate pickle
221
+ * Adapter based architecture, supports Machinist, FactoryGirl, and vanilla ActiveRecord
222
+
223
+ * 1 minor enhancement
224
+ * model_names now defaults to subclasses of AR::Base
225
+ * #original_model => #created_model
226
+
227
+
228
+ == 0.1.1
229
+
230
+ * 1 major enhancement:
231
+ * made pickle a github gem
232
+
233
+ * 1 minor enhancement:
234
+ * Added intentions for pickle in README.textile
235
+
236
+
237
+ == Prior to gems
238
+
239
+ * Initial release: everything is subject to sweeping change
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2009 Ian White - ian.w.white@gmail.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,246 @@
1
+ = pickle
2
+
3
+ Pickle gives you cucumber steps that create your models easily from factory-girl or
4
+ machinist factories/blueprints. You can also just use ActiveRecord but it's not as cool.
5
+
6
+ References to the models are stored in the current world, not necessarily for the purpose of checking the db
7
+ (although you could use it for that), but for enabling easy reference to urls, and for
8
+ building complex givens which require a bunch of models collaborating
9
+
10
+ == Resources
11
+
12
+ <b>Github</b> for code: http://github.com/ianwhite/pickle
13
+
14
+ <b>Gemcutter</b> for the gem: http://gemcutter.org/gems/pickle
15
+
16
+ <b>API</b> docs: http://ianwhite.github.com/pickle/doc
17
+
18
+ <b>Google group</b> for questions: http://groups.google.com/group/pickle-cucumber
19
+
20
+ <b>Lighthouse</b> for bugs: http://ianwhite.lighthouseapp.com/projects/25941-pickle
21
+
22
+ <b>Railscast</b> presentation: http://railscasts.com/episodes/186-pickle-with-cucumber
23
+
24
+ <b>Blog articles</b>: {dynamic50: Integration testing with cucumber and pickle}[http://blog.dynamic50.com/index.php/2009/04/integration-testing-with-cucumber-and-pickle/], {rubyflare: pickle my cucumber}[http://rubyflare.com/2009/10/28/pickle-my-cucumber/]
25
+
26
+ == Install
27
+
28
+ Install pickle either as a rails plugin, or a gem
29
+
30
+ # gem from gemcutter
31
+ sudo gem install pickle
32
+
33
+ # gem dependency (in config/environments/cucumber.rb)
34
+ config.gem 'pickle'
35
+
36
+ # plugin
37
+ script/plugin install git://github.com/ianwhite/pickle.git
38
+
39
+ # or, plugin as submodule
40
+ git submodule add git://github.com/ianwhite/pickle.git vendor/plugins/pickle
41
+
42
+ == CI
43
+
44
+ It's tested against all stable branches of 2.x rails, and edge, with the latest versions of rspec, cucumber, factory_girl, machinist.
45
+
46
+ == Contributors
47
+
48
+ The following people have made Pickle better:
49
+
50
+ * {Nick Rutherford}[http://github.com/nruth]
51
+ * Tobi Knaup
52
+ * {Michael MacDonald}[http://github.com/schlick]
53
+
54
+ == Get Started
55
+
56
+ (you'd better install cucumber)
57
+
58
+ script/generate pickle [paths] [email]
59
+
60
+ Now have a look at <tt>features/step_definitions/pickle_steps.rb</tt>
61
+
62
+ If you want path steps and email steps then just add 'paths' and/or 'email'. The code/steps will be
63
+ written to <tt>features/env/paths.rb</tt> and
64
+ <tt>features/step_definitions/email_steps.rb</tt> respectively.
65
+
66
+ === Using with plain ole Active Record
67
+
68
+ If you have an AR called 'Post', with required fields 'title', and 'body', then you can now write
69
+ steps like this
70
+
71
+ Given a post exists with title: "My Post", body: "My body"
72
+
73
+ === Using with factory-girl or machinist
74
+
75
+ But you're using Machinist or FactoryGirl right?! To leverage all of the factories/blueprints
76
+ you've written, you can just do stuff like
77
+
78
+ Given a user exists
79
+ And another user exists with role: "admin"
80
+
81
+ # later
82
+ Then a user should exist with name: "Fred"
83
+ And that user should be activated # this uses rspec predicate matchers
84
+
85
+ ==== Machinst: require your blueprints and reset Shams
86
+
87
+ (The latest version of pickle supports {multiple blueprints}[http://github.com/notahat/machinist/commit/d6492e6927a8aa1819926e48b22377171fd20496], for
88
+ earlier versions of machinist use pickle <= 0.1.10)
89
+
90
+ In your <tt>features/support/env.rb</tt> add the following lines at the bottom
91
+
92
+ require "#{Rails.root}/spec/blueprints" # or wherever they live
93
+ Before { Sham.reset } # reset Shams in between scenarios
94
+
95
+ ==== FactoryGirl: make sure factories are loaded
96
+
97
+ In your config/environments/cucumber.rb file, make sure the factory-girl gem is included (unless it's installed as a plugin).
98
+
99
+ If that doesn't solve loading issues then require your factories.rb file directly in a file called 'features/support/factory_girl.rb'
100
+
101
+ # example features/support/factory_girl.rb
102
+ require File.dirname(__FILE__) + '/../../spec/factories'
103
+
104
+ === Configuring Pickle
105
+
106
+ You can tell pickle to use another factory adapter (see Pickle::Adapter), or
107
+ create mappings from english expressions to pickle model names. You can also
108
+ override many of the options on the Pickle::Config object if you so choose.
109
+
110
+ In: <tt>features/support/pickle.rb</tt>
111
+
112
+ require 'pickle/world'
113
+
114
+ Pickle.configure do |config|
115
+ config.adapters = [:machinist, YourOwnAdapterClass]
116
+ config.map 'me', 'myself', 'my', 'I', :to => 'user: "me"'
117
+ end
118
+
119
+ Out of the box pickle looks for machinist, then factory-girl, then finally active-record 'factories'.
120
+ If you find that your steps aren't working with your factories, it's probably the case that your factory
121
+ setup is not being included in your cucumber environment (see comments above regarding machinist and factory-girl).
122
+
123
+ == API
124
+
125
+ === Steps
126
+
127
+ When you run <tt>script/generate pickle</tt> you get the following steps
128
+
129
+ ==== Given steps
130
+
131
+ "Given <b>a model</b> exists", e.g.
132
+
133
+ Given a user exists
134
+ Given a user: "fred" exists
135
+ Given the user exists
136
+
137
+ "Given <b>a model</b> exists with <b>fields</b>", e.g.
138
+
139
+ Given a user exists with name: "Fred"
140
+ Given a user exists with name: "Fred", activated: false
141
+
142
+ You can refer to other models in the fields
143
+
144
+ Given a user exists
145
+ And a post exists with author: the user
146
+
147
+ Given a person: "fred" exists
148
+ And a person: "ethel" exists
149
+ And a fatherhood exists with parent: user "fred", child: user "ethel"
150
+
151
+ "Given <b>n models</b> exist", e.g.
152
+
153
+ Given 10 users exist
154
+
155
+ "Given <b>n models</b> exist with <b>fields</b>", examples:
156
+
157
+ Given 10 users exist with activated: false
158
+
159
+ ==== Then steps
160
+
161
+ ===== Asserting existence of models
162
+
163
+ "Then <b>a model</b> should exist", e.g.
164
+
165
+ Then a user should exist
166
+
167
+ "Then <b>a model</b> should exist with <b>fields</b>", e.g.
168
+
169
+ Then a user: "fred" should exist with name: "Fred" # we can label the found user for later use
170
+
171
+ You can use other models, booleans, numerics, and strings as fields
172
+
173
+ Then a person should exist with child: person "ethel"
174
+ Then a user should exist with activated: false
175
+ Then a user should exist with activated: true, email: "fred@gmail.com"
176
+
177
+ "Then <b>n models</b> should exist", e.g.
178
+
179
+ Then 10 events should exist
180
+
181
+ "Then <b>n models</b> should exist with <b>fields</b>", e.g.
182
+
183
+ Then 2 people should exist with father: person "fred"
184
+
185
+ ===== Asserting associations
186
+
187
+ One-to-one assocs: "Then <b>a model</b> should be <b>other model</b>'s <b>association</b>", e.g.
188
+
189
+ Then the person: "fred" should be person: "ethel"'s father
190
+
191
+ Many-to-one assocs: "Then <b>a model</b> should be [in|one of] <b>other model</b>'s <b>association</b>", e.g.
192
+
193
+ Then the person: "ethel" should be one of person: "fred"'s children
194
+ Then the comment should be in the post's comments
195
+
196
+ ===== Asserting predicate methods
197
+
198
+ "Then <b>a model</b> should [be|have] [a|an] <b>predicate</b>", e.g.
199
+
200
+ Then the user should have a status # => user.status?.should == true
201
+ Then the car: "batmobile" should be fast # => car.fast?.should == true
202
+
203
+ "Then <b>a model</b> should not [be|have] [a|an] <b>predicate</b>", e.g.
204
+
205
+ Then person: "fred" should not be childless # => fred.childless?.should == false
206
+
207
+ === Regexps for use in your own steps
208
+
209
+ By default you get some regexps available in the main namespace for use
210
+ in creating your own steps: `capture_model`, `capture_fields`, and others (see lib/pickle.rb)
211
+
212
+ (You can use any of the regexps that Pickle uses by using the Pickle.parser namespace, see
213
+ Pickle::Parser::Matchers for the methods available)
214
+
215
+ *capture_model*
216
+
217
+ Given /^#{capture_model} exists$/ do |model_name|
218
+ model(model_name).should_not == nil
219
+ end
220
+
221
+ Then /^I should be at the (.*?) page$/ |page|
222
+ if page =~ /#{capture_model}'s/
223
+ url_for(model($1))
224
+ else
225
+ # ...
226
+ end
227
+ end
228
+
229
+ Then /^#{capture_model} should be one of #{capture_model}'s posts$/ do |post, forum|
230
+ post = model!(post)
231
+ forum = model!(forum)
232
+ forum.posts.should include(post)
233
+ end
234
+
235
+ *capture_fields*
236
+
237
+ This is useful for setting attributes, and knows about pickle model names so that you
238
+ can build up composite objects with ease
239
+
240
+ Given /^#{capture_model} exists with #{capture_fields}$/ do |model_name, fields|
241
+ create_model(model_name, fields)
242
+ end
243
+
244
+ # example of use
245
+ Given a user exists
246
+ And a post exists with author: the user # this step will assign the above user as :author on the post
data/Rakefile ADDED
@@ -0,0 +1,110 @@
1
+ # use pluginized rpsec if it exists
2
+ rspec_base = File.expand_path(File.dirname(__FILE__) + '/../rspec/lib')
3
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) and !$LOAD_PATH.include?(rspec_base)
4
+
5
+ require 'spec/rake/spectask'
6
+ require 'spec/rake/verify_rcov'
7
+
8
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
9
+ require 'pickle/version'
10
+
11
+ PluginName = 'pickle'
12
+
13
+ task :default => [:spec]
14
+
15
+ desc "Run the specs for #{PluginName}"
16
+ Spec::Rake::SpecTask.new(:spec) do |t|
17
+ t.spec_files = FileList['spec/**/*_spec.rb']
18
+ t.spec_opts = ["--colour"]
19
+ end
20
+
21
+ desc "Generate RCov report for #{PluginName}"
22
+ Spec::Rake::SpecTask.new(:rcov) do |t|
23
+ t.spec_files = FileList['spec/**/*_spec.rb']
24
+ t.rcov = true
25
+ t.rcov_dir = 'doc/coverage'
26
+ t.rcov_opts = ['--text-report', '--exclude', "/Library,spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}"]
27
+ end
28
+
29
+ namespace :rcov do
30
+ desc "Verify RCov threshold for #{PluginName}"
31
+ RCov::VerifyTask.new(:verify => :rcov) do |t|
32
+ t.threshold = 100.0
33
+ t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
34
+ end
35
+ end
36
+
37
+ # cucumber features require an enclosing rails app
38
+ plugins_base = File.expand_path(File.join(File.dirname(__FILE__), '..'))
39
+ cucumber_base = File.join(plugins_base, 'cucumber/lib')
40
+ if File.exists?(cucumber_base) && plugins_base =~ /\/vendor\/plugins$/ # if we're in rails app
41
+ $:.unshift(cucumber_base)
42
+ require 'cucumber/rake/task'
43
+
44
+ desc "Run features for #{PluginName} (progress)"
45
+ Cucumber::Rake::Task.new(:features) do |t|
46
+ t.fork = true
47
+ t.cucumber_opts = ['--format', 'progress', '--require', 'features']
48
+ end
49
+
50
+ desc "Run features for #{PluginName} (full output)"
51
+ namespace :features do
52
+ Cucumber::Rake::Task.new(:full) do |t|
53
+ t.cucumber_opts = ['--format', 'pretty', '--require', 'features']
54
+ end
55
+ end
56
+ end
57
+
58
+ # the following optional tasks are for CI, gems and doc building
59
+ begin
60
+ require 'hanna/rdoctask'
61
+ require 'garlic/tasks'
62
+ require 'grancher/task'
63
+
64
+ task :cruise => ['garlic:all', 'doc:publish']
65
+
66
+ Rake::RDocTask.new(:doc) do |d|
67
+ d.options << '--all'
68
+ d.rdoc_dir = 'doc'
69
+ d.main = 'README.rdoc'
70
+ d.title = "#{PluginName} API docs"
71
+ d.rdoc_files.include('README.rdoc', 'History.txt', 'License.txt', 'Todo.txt', 'lib/**/*.rb')
72
+ end
73
+
74
+ namespace :doc do
75
+ task :publish => :doc do
76
+ Rake::Task['doc:push'].invoke unless uptodate?('.git/refs/heads/gh-pages', 'doc')
77
+ end
78
+
79
+ Grancher::Task.new(:push) do |g|
80
+ g.keep_all
81
+ g.directory 'doc', 'doc'
82
+ g.branch = 'gh-pages'
83
+ g.push_to = 'origin'
84
+ end
85
+ end
86
+ rescue LoadError
87
+ end
88
+
89
+ begin
90
+ require 'jeweler'
91
+
92
+ Jeweler::Tasks.new do |s|
93
+ s.name = "pickle"
94
+ s.version = Pickle::Version::String
95
+ s.summary = "Easy model creation and reference in your cucumber features"
96
+ s.description = "Easy model creation and reference in your cucumber features"
97
+ s.email = "ian.w.white@gmail.com"
98
+ s.homepage = "http://github.com/ianwhite/pickle/tree"
99
+ s.authors = ["Ian White"]
100
+ end
101
+
102
+ Jeweler::GemcutterTasks.new
103
+
104
+ namespace :release do
105
+ task :all => ['release', 'gemcutter:release']
106
+ end
107
+
108
+ rescue LoadError
109
+ puts "Jeweler not available for gem tasks. Install it with: sudo gem install jeweler"
110
+ end
data/Todo.txt ADDED
@@ -0,0 +1,4 @@
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
+ * fix problem with save_and_open_emails
4
+ * Translations
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1