pickle 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ == 0.3.1
2
+
3
+ * 1 major improvement
4
+ * Rails 3 support for generators [H.J. Blok, szimek]
5
+
6
+
1
7
  == 0.3.0
2
8
 
3
9
  * 2 major improvements
@@ -10,76 +10,66 @@ References to the models are stored in the current world, not necessarily for th
10
10
  (although you could use it for that), but for enabling easy reference to urls, and for
11
11
  building complex givens which require a bunch of models collaborating
12
12
 
13
- == Resources
14
-
15
- <b>Github</b> for code: http://github.com/ianwhite/pickle
13
+ == Quickstart
16
14
 
17
- <b>Gemcutter</b> for the gem: http://gemcutter.org/gems/pickle
15
+ This is a quickstart guide for rails apps. Firstly, install {cucumber-rails}[http://github.com/aslakhellesoy/cucumber-rails], and its dependencies.
16
+ Then do the following:
18
17
 
19
- <b>API</b> docs: {Pickle rdoc on github}[http://ianwhite.github.com/pickle/doc/]
18
+ === Rails 3:
20
19
 
21
- <b>Google group</b> for questions: http://groups.google.com/group/pickle-cucumber
20
+ Add the gem to your Gemfile:
22
21
 
23
- <b>Lighthouse</b> for bugs: http://ianwhite.lighthouseapp.com/projects/25941-pickle
22
+ gem 'pickle'
23
+
24
+ Then install with:
24
25
 
25
- <b>Railscast</b> presentation: http://railscasts.com/episodes/186-pickle-with-cucumber
26
+ bundle install
27
+
28
+ Discover the options for the generator:
26
29
 
27
- <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/]
30
+ rails g pickle --help
28
31
 
29
- == Install
32
+ Run the generator, e.g:
30
33
 
31
- Install pickle either as a rails plugin, or a gem
34
+ rails g pickle --paths --email
35
+
36
+ === For Rails 2:
32
37
 
33
- # gem from gemcutter
34
- sudo gem install pickle
38
+ Add the following to config/environments/cucumber:
35
39
 
36
- # gem dependency (in config/environments/cucumber.rb)
37
40
  config.gem 'pickle'
38
41
 
39
- # plugin
40
- script/plugin install git://github.com/ianwhite/pickle.git
42
+ Install the gem with
41
43
 
42
- # or, plugin as submodule
43
- git submodule add git://github.com/ianwhite/pickle.git vendor/plugins/pickle
44
+ rake gems:install RAILS_ENV=cucumber
45
+
46
+ Run the generator with:
44
47
 
45
- == CI
46
-
47
- It's tested against all stable branches of 2.x rails, and edge, with the latest versions of rspec, cucumber, factory_girl, machinist.
48
-
49
- == Run the tests
48
+ script/generate pickle [paths] [email]
50
49
 
51
- To run the specs do:
50
+ == Resources
52
51
 
53
- rake spec
52
+ <b>Github</b> for code: http://github.com/ianwhite/pickle
54
53
 
55
- To run the features (rails 2.3 only ATM):
54
+ <b>Gemcutter</b> for the gem: http://gemcutter.org/gems/pickle
56
55
 
57
- rake cucumber
56
+ <b>Rdoc.info</b> for docs: http://rdoc.info/projects/ianwhite/pickle
58
57
 
59
- == Contributors
58
+ <b>Google group</b> for questions: http://groups.google.com/group/pickle-cucumber
60
59
 
61
- The following people have made Pickle better:
60
+ <b>Lighthouse</b> for bugs: http://ianwhite.lighthouseapp.com/projects/25941-pickle
62
61
 
63
- * {Daniel Neighman}[http://github.com/hassox]
64
- * {Josh Bassett}[http://github.com/nullobject]
65
- * {Nick Rutherford}[http://github.com/nruth]
66
- * {Tobi Knaup}[http://github.com/guenter]
67
- * {Michael MacDonald}[http://github.com/schlick]
68
- * {Michael Moen}[http://github.com/UnderpantsGnome]
69
- * {Myron Marston}[http://github.com/myronmarston]
70
- * {Stephan Hagemann}[http://github.com/xing]
71
- * {Chris Flipse}[http://github.com/cflipse]
62
+ <b>Railscast</b> presentation: http://railscasts.com/episodes/186-pickle-with-cucumber
72
63
 
73
- == Get Started
64
+ <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/]
74
65
 
75
- (you'd better install cucumber)
76
66
 
77
- script/generate pickle [paths] [email]
67
+ == Using Pickle
78
68
 
79
69
  Now have a look at <tt>features/step_definitions/pickle_steps.rb</tt>
80
70
 
81
- If you want path steps and email steps then just add 'paths' and/or 'email'. The code/steps will be
82
- written to <tt>features/env/paths.rb</tt> and
71
+ If you want path steps and email steps then just add the 'paths' and/or 'email' options to the generator.
72
+ The code/steps will be written to <tt>features/env/paths.rb</tt> and
83
73
  <tt>features/step_definitions/email_steps.rb</tt> respectively.
84
74
 
85
75
  === Using with plain ole Active Record or DataMapper
@@ -297,3 +287,29 @@ can build up composite objects with ease
297
287
  # example of use
298
288
  Given a user exists
299
289
  And a post exists with author: the user # this step will assign the above user as :author on the post
290
+
291
+ == Run the tests
292
+
293
+ To run the specs do:
294
+
295
+ rake spec
296
+
297
+ To run the features (rails 2.3 only ATM):
298
+
299
+ rake cucumber
300
+
301
+ == Contributors
302
+
303
+ The following people have made Pickle better:
304
+
305
+ * {Szymon Nowak}[http://github.com/szimek]
306
+ * {H.J. Blok}[http://github.com/hjblok]
307
+ * {Daniel Neighman}[http://github.com/hassox]
308
+ * {Josh Bassett}[http://github.com/nullobject]
309
+ * {Nick Rutherford}[http://github.com/nruth]
310
+ * {Tobi Knaup}[http://github.com/guenter]
311
+ * {Michael MacDonald}[http://github.com/schlick]
312
+ * {Michael Moen}[http://github.com/UnderpantsGnome]
313
+ * {Myron Marston}[http://github.com/myronmarston]
314
+ * {Stephan Hagemann}[http://github.com/xing]
315
+ * {Chris Flipse}[http://github.com/cflipse]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -0,0 +1,69 @@
1
+ require 'rails/generators'
2
+
3
+ class PickleGenerator < Rails::Generators::Base
4
+ desc "Generates Pickle step files."
5
+
6
+ # Use the same templates as Rails 2 generator
7
+ source_root File.expand_path("../../../rails_generators/pickle/templates", __FILE__)
8
+
9
+ class_option :paths, :desc => "Generate features/support/paths.rb file.", :type => :boolean
10
+ class_option :email, :desc => "Generate features/step_definitions/email_steps.rb file", :type => :boolean
11
+
12
+ def initialize(args = [], options = {}, config = {})
13
+ super
14
+
15
+ if self.options.paths? && !File.exists?("features/support/paths.rb")
16
+ say "features/support/paths.rb not found, is your cucumber up to date?", :red
17
+ exit
18
+ end
19
+ end
20
+
21
+ def create_directories
22
+ empty_directory "features/step_definitions"
23
+ empty_directory "features/support"
24
+ end
25
+
26
+ def copy_pickle_steps_file
27
+ template "pickle_steps.rb", "features/step_definitions/pickle_steps.rb"
28
+ template "pickle.rb", "features/support/pickle.rb"
29
+ end
30
+
31
+ def copy_paths_file
32
+ return unless options.paths?
33
+
34
+ current_paths = File.read("features/support/paths.rb")
35
+ unless current_paths.include?('#{capture_model}')
36
+ if current_paths =~ /^(.*)(\n\s+else\n\s+raise "Can't find.*".*$)/m
37
+ @current_paths_header = $1
38
+ @current_paths_footer = $2
39
+ end
40
+ template "paths.rb", "features/support/paths.rb"
41
+ end
42
+ end
43
+
44
+ def copy_email_steps_file
45
+ return unless options.email?
46
+ template "email_steps.rb", "features/step_definitions/email_steps.rb"
47
+ template "email.rb", "features/support/email.rb"
48
+ end
49
+
50
+
51
+ private
52
+
53
+ # Compatibility methods for Rails 2 templates
54
+ def pickle_path
55
+ options.paths?
56
+ end
57
+
58
+ def pickle_email
59
+ options.email?
60
+ end
61
+
62
+ def current_paths_header
63
+ @current_paths_header
64
+ end
65
+
66
+ def current_paths_footer
67
+ @current_paths_footer
68
+ end
69
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pickle}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
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{2010-06-23}
12
+ s.date = %q{2010-07-31}
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 = [
@@ -52,6 +52,7 @@ Gem::Specification.new do |s|
52
52
  "features/support/pickle.rb",
53
53
  "features/support/pickle_app.rb",
54
54
  "init.rb",
55
+ "lib/generators/pickle_generator.rb",
55
56
  "lib/pickle.rb",
56
57
  "lib/pickle/adapter.rb",
57
58
  "lib/pickle/adapters/active_record.rb",
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
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: 2010-06-23 00:00:00 +01:00
18
+ date: 2010-07-31 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -64,6 +64,7 @@ files:
64
64
  - features/support/pickle.rb
65
65
  - features/support/pickle_app.rb
66
66
  - init.rb
67
+ - lib/generators/pickle_generator.rb
67
68
  - lib/pickle.rb
68
69
  - lib/pickle/adapter.rb
69
70
  - lib/pickle/adapters/active_record.rb