cukesalad 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/Examples/Calculator/Gemfile +1 -1
  2. data/Examples/Calculator/Gemfile.lock +7 -7
  3. data/Examples/Calculator/README.md +12 -4
  4. data/Examples/Calculator/Rakefile +42 -0
  5. data/Examples/Calculator/cucumber.yml +4 -2
  6. data/Examples/Calculator/features/README.md +18 -0
  7. data/Examples/Calculator/features/a_place_to_start.feature +1 -1
  8. data/Examples/Calculator/features/complex_calculations.feature +1 -1
  9. data/Examples/Calculator/features/lib/{default/roles → roles/back_door}/calculating_individual.rb +1 -2
  10. data/Examples/Calculator/features/lib/roles/front_door/calculating_individual.rb +11 -0
  11. data/Examples/Calculator/features/lib/roles/side_door/calculating_individual.rb +11 -0
  12. data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/add.rb +0 -0
  13. data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/calculate.rb +0 -0
  14. data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/subtract.rb +0 -0
  15. data/Examples/Calculator/features/lib/{default/tasks → tasks}/questions/see_the_answer.rb +0 -0
  16. data/Examples/Calculator/features/lib/{default/tasks → tasks}/reference/calculations.rb +2 -3
  17. data/Examples/Calculator/features/lib/{default/tasks → tasks}/switch_on_the_calculator.rb +0 -0
  18. data/Examples/Calculator/features/typical_workflow.feature +1 -1
  19. data/Examples/Calculator/lib/calculator.rb +3 -0
  20. data/Examples/Calculator/{features/lib/browser/roles/calculating_web_user.rb → lib/web_calculating_individual.rb} +2 -11
  21. data/Examples/Calculator/lib/web_calculator.rb +1 -2
  22. data/Gemfile.lock +10 -13
  23. data/VERSION +1 -1
  24. data/cukesalad.gemspec +2 -2
  25. data/features/creating_a_new_project.feature +2 -2
  26. data/features/defining_roles/define_a_role.feature +16 -17
  27. data/features/defining_roles/prepare_the_actor_for_the_role.feature +24 -25
  28. data/features/defining_tasks/define_a_task.feature +53 -57
  29. data/features/defining_tasks/define_a_task_with_arguments.feature +3 -3
  30. data/features/defining_tasks/remember_information_between_steps.feature +6 -7
  31. data/features/expectations/expressing_expectations.feature +22 -22
  32. data/features/lib/tasks/create_a_file.rb +4 -2
  33. data/features/lib/tasks/create_a_role.rb +2 -3
  34. data/features/lib/tasks/create_a_task.rb +12 -10
  35. data/features/lib/tasks/interactively_run.rb +1 -1
  36. data/features/lib/tasks/run_a_scenario.rb +1 -1
  37. data/lib/cukesalad/cucumber_steps.rb +1 -1
  38. data/lib/cukesalad/director.rb +1 -1
  39. data/lib/cukesalad/version.rb +1 -1
  40. metadata +18 -15
  41. data/Examples/Calculator/lib/calculator_operations.rb +0 -4
@@ -1,5 +1,5 @@
1
1
  source :rubygems
2
- gem "cukesalad", ">=0.7"
2
+ gem "cukesalad", ">=0.8.1"
3
3
  gem "rspec", ">=2.5.0", :require => 'spec'
4
4
  gem "capybara", ">=0.4.1.2"
5
5
  gem "sinatra", ">=1.2.0"
@@ -20,19 +20,19 @@ GEM
20
20
  xpath (~> 0.1.4)
21
21
  childprocess (0.2.2)
22
22
  ffi (~> 1.0.6)
23
- cucumber (1.0.2)
23
+ cucumber (1.0.6)
24
24
  builder (>= 2.1.2)
25
25
  diff-lcs (>= 1.1.2)
26
- gherkin (~> 2.4.5)
26
+ gherkin (~> 2.4.18)
27
27
  json (>= 1.4.6)
28
- term-ansicolor (>= 1.0.5)
29
- cukesalad (0.8.0)
28
+ term-ansicolor (>= 1.0.6)
29
+ cukesalad (0.8.1)
30
30
  aruba (= 0.4.3)
31
- cucumber (= 1.0.2)
31
+ cucumber (= 1.0.6)
32
32
  rspec (>= 2.5.0)
33
33
  diff-lcs (1.1.3)
34
34
  ffi (1.0.9)
35
- gherkin (2.4.18)
35
+ gherkin (2.4.21)
36
36
  json (>= 1.4.6)
37
37
  json (1.5.4)
38
38
  json_pure (1.5.4)
@@ -83,7 +83,7 @@ PLATFORMS
83
83
 
84
84
  DEPENDENCIES
85
85
  capybara (>= 0.4.1.2)
86
- cukesalad (>= 0.7)
86
+ cukesalad (>= 0.8.1)
87
87
  rspec (>= 2.5.0)
88
88
  sinatra (>= 1.2.0)
89
89
  sinatra-reloader (= 0.5.0)
@@ -6,13 +6,21 @@ Setup the environment:
6
6
 
7
7
  bundle install
8
8
 
9
- Then you can run the examples:
9
+ Then you can run the examples quickly (via rack_test):
10
10
 
11
- bundle exec cucumber
11
+ rake check:features
12
12
 
13
- To run these via a web front end, use:
13
+ To run these via a web browser, use:
14
14
 
15
- bundle exec cucumber -p alternative
15
+ rake check:features:front_door
16
+
17
+ To run these via rack_test, use:
18
+
19
+ rake check:features:side_door
20
+
21
+ To run these against the calculator API, use:
22
+
23
+ rake check:features:back_door
16
24
 
17
25
  To run the Calculator app
18
26
 
@@ -0,0 +1,42 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ namespace :check do
5
+ require 'rspec/core'
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:design) do |spec|
8
+ spec.pattern = FileList['spec/**/*_spec.rb']
9
+ spec.rspec_opts = "-cfd"
10
+ end
11
+
12
+ require 'cucumber/rake/task'
13
+ Cucumber::Rake::Task.new(:features)
14
+
15
+ namespace :features do
16
+ Cucumber::Rake::Task.new(:back_door) do |wip|
17
+ wip.cucumber_opts = "-p back_door"
18
+ end
19
+
20
+ Cucumber::Rake::Task.new(:side_door) do |wip|
21
+ wip.cucumber_opts = "-p side_door"
22
+ end
23
+
24
+ Cucumber::Rake::Task.new(:front_door) do |wip|
25
+ wip.cucumber_opts = "-p front_door"
26
+ end
27
+ end
28
+
29
+ desc "Check absolutely everything!"
30
+ task :everything => [
31
+ 'check:design',
32
+ 'check:features:back_door',
33
+ 'check:features:side_door',
34
+ 'check:features:front_door'
35
+ ]
36
+ end
37
+
38
+ desc "Check design and features"
39
+ task :default => [
40
+ 'check:design',
41
+ 'check:features:side_door'
42
+ ]
@@ -1,4 +1,6 @@
1
- default: --exclude features/lib/alternative/
2
- front_door: -r features/lib/browser/ -r features/support/env.rb -r features/lib/default/tasks/
1
+ default: -p side_door
2
+ front_door: --exclude features/lib/roles/back_door --exclude features/lib/roles/side_door
3
+ side_door: --exclude features/lib/roles/back_door --exclude features/lib/roles/front_door
4
+ back_door: --exclude features/lib/roles/front_door --exclude features/lib/roles/side_door
3
5
  autotest: --color
4
6
  autotest-all: --color
@@ -0,0 +1,18 @@
1
+ These scenarios are examples of what you might write using [cukesalad](http://cukesalad.info).
2
+
3
+ cukesalad is an extension to cucumber that does away with regular expression.
4
+
5
+ The examples are for your **typical calculator**. To 'automate' this:
6
+
7
+ When I add, the number '1' to the number '2'
8
+
9
+ You might write something like this:
10
+
11
+ in_order_to 'add', the_number: :first_number, and_the_number: :second_number do
12
+ enter the :first_number
13
+ press :plus
14
+ enter the :second_number
15
+ press :equals
16
+ end
17
+
18
+ You can find the code behind these [on Github](https://github.com/RiverGlide/CukeSalad/tree/master/Examples/Calculator).
@@ -5,5 +5,5 @@ Feature: A Place To Start
5
5
 
6
6
  Scenario: Let's Begin
7
7
  Given I am a Calculating Individual
8
- When I attempt to switch on the calculator
8
+ When I switch on the calculator
9
9
  Then I should see the answer '0'
@@ -5,7 +5,7 @@ Feature: Complex Calculations
5
5
 
6
6
  Scenario Outline: Get the result of a more complex calculation
7
7
  Given I am a calculating individual
8
- When I attempt to calculate, with the following '<calculation>'
8
+ When I calculate, with the following '<calculation>'
9
9
  Then I should see the answer '<correct_result>'
10
10
 
11
11
  Examples:
@@ -1,5 +1,4 @@
1
1
  require 'calculator'
2
- require 'calculator_operations'
3
2
 
4
3
  module CalculatingIndividual
5
4
 
@@ -9,7 +8,7 @@ module CalculatingIndividual
9
8
 
10
9
  def switch_on_the_calculator
11
10
  @calculator = Calculator.new
12
- @operate_with = CalculatorOperations::OPERATIONS
11
+ @operate_with = Calculator::OPERATIONS
13
12
  end
14
13
 
15
14
  def enter value
@@ -0,0 +1,11 @@
1
+ require 'web_calculator'
2
+ require 'web_calculating_individual'
3
+ require 'capybara/dsl'
4
+
5
+ Capybara.app = WebCalculator
6
+ Capybara.default_driver = :selenium
7
+
8
+ module CalculatingIndividual
9
+
10
+ include WebCalculatingIndividual
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'web_calculator'
2
+ require 'web_calculating_individual'
3
+ require 'capybara/dsl'
4
+
5
+ Capybara.app = WebCalculator
6
+ Capybara.default_driver = :rack_test
7
+
8
+ module CalculatingIndividual
9
+
10
+ include WebCalculatingIndividual
11
+ end
@@ -1,4 +1,3 @@
1
- require 'calculator_operations'
2
1
 
3
2
  module Calculations
4
3
 
@@ -7,10 +6,10 @@ module Calculations
7
6
  end
8
7
 
9
8
  def enter_numbers_and_operators_for sum
10
- operators = CalculatorOperations::OPERATORS
9
+ operators = Calculator::OPERATORS
11
10
  sum.each do | token |
12
11
  enter token.to_i if token =~ /\d+/
13
- press operators[token] if operators.include? token
12
+ press operators[token].to_sym if operators.include? token
14
13
  end
15
14
  end
16
15
  end
@@ -5,7 +5,7 @@ Feature: Typical Calculator Workflow
5
5
 
6
6
  Scenario Outline: See what I expect based on specific interactions
7
7
  Given I am a calculating individual
8
- When I attempt to calculate: with the following '<interactions>'
8
+ When I calculate, with the following '<interactions>'
9
9
  Then I should see the answer '<expected>'
10
10
 
11
11
  Examples:
@@ -1,6 +1,9 @@
1
1
 
2
2
  class Calculator
3
3
 
4
+ OPERATIONS = { 'plus' => '+', 'minus' => '-', 'equals' => '=' }
5
+ OPERATORS = OPERATIONS.invert
6
+
4
7
  attr_reader :display
5
8
 
6
9
  def initialize
@@ -1,16 +1,7 @@
1
- # To run with this version of the Calculating Individual:
2
- # cucumber --profile alternative
3
-
4
- require 'web_calculator'
5
- require 'capybara'
6
1
  require 'capybara/dsl'
2
+ module WebCalculatingIndividual
7
3
 
8
- Capybara.app = WebCalculator
9
- Capybara.default_driver = :selenium
10
-
11
- module CalculatingIndividual
12
-
13
- include Capybara
4
+ include Capybara::DSL
14
5
 
15
6
  def role_preparation
16
7
  switch_on_the_calculator
@@ -3,7 +3,6 @@ require 'erb'
3
3
 
4
4
  $:.unshift(File.dirname(__FILE__), '.')
5
5
  require 'calculator'
6
- require 'calculator_operations'
7
6
 
8
7
  class WebCalculator < Sinatra::Base
9
8
 
@@ -15,7 +14,7 @@ class WebCalculator < Sinatra::Base
15
14
 
16
15
  helpers do
17
16
  def available_operations
18
- CalculatorOperations::OPERATIONS
17
+ Calculator::OPERATIONS
19
18
  end
20
19
 
21
20
  def operate_with operator
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cukesalad (0.8.0)
4
+ cukesalad (0.8.1)
5
5
  aruba (= 0.4.3)
6
- cucumber (= 1.0.2)
6
+ cucumber (= 1.0.6)
7
7
  rspec (>= 2.5.0)
8
8
 
9
9
  GEM
@@ -21,30 +21,27 @@ GEM
21
21
  builder (3.0.0)
22
22
  childprocess (0.2.2)
23
23
  ffi (~> 1.0.6)
24
- cucumber (1.0.2)
24
+ cucumber (1.0.6)
25
25
  builder (>= 2.1.2)
26
26
  diff-lcs (>= 1.1.2)
27
- gherkin (~> 2.4.5)
27
+ gherkin (~> 2.4.18)
28
28
  json (>= 1.4.6)
29
- term-ansicolor (>= 1.0.5)
29
+ term-ansicolor (>= 1.0.6)
30
30
  diff-lcs (1.1.3)
31
31
  ffi (1.0.9)
32
- ffi (1.0.9-java)
33
- gherkin (2.4.18)
34
- json (>= 1.4.6)
35
- gherkin (2.4.18-java)
32
+ gherkin (2.4.21)
36
33
  json (>= 1.4.6)
37
34
  json (1.4.6)
38
35
  json (1.4.6-java)
39
36
  mime-types (1.16)
40
- rack (1.3.2)
41
- rake (0.8.7)
37
+ rack (1.3.3)
38
+ rake (0.9.2)
42
39
  rdiscount (1.6.8)
43
40
  relish (0.3.0)
44
41
  archive-tar-minitar (~> 0.5.2)
45
42
  json (~> 1.4.6)
46
43
  rest-client (~> 1.6.1)
47
- rest-client (1.6.3)
44
+ rest-client (1.6.7)
48
45
  mime-types (>= 1.16)
49
46
  rspec (2.6.0)
50
47
  rspec-core (~> 2.6.0)
@@ -63,5 +60,5 @@ PLATFORMS
63
60
  DEPENDENCIES
64
61
  bundler (~> 1.0.0)
65
62
  cukesalad!
66
- rake (~> 0.8.7)
63
+ rake (~> 0.9.2)
67
64
  relish (= 0.3.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.8.1
data/cukesalad.gemspec CHANGED
@@ -25,11 +25,11 @@ Gem::Specification.new do |s|
25
25
  s.default_executable = "cukesalad"
26
26
  s.require_paths = ["lib"]
27
27
 
28
- s.add_runtime_dependency "cucumber", "1.0.2" # Version 1.0.4 experiences following error: 'Illformed requirement ["#<Syck::DefaultKey:0x000001034764a0> 0.8.4"]'
28
+ s.add_runtime_dependency "cucumber", "1.0.6"
29
29
  s.add_runtime_dependency "rspec", ">=2.5.0"
30
30
  s.add_runtime_dependency "aruba", "0.4.3"
31
31
 
32
32
  s.add_development_dependency "bundler", "~> 1.0.0"
33
- s.add_development_dependency "rake", "~> 0.8.7"
33
+ s.add_development_dependency "rake", "~> 0.9.2"
34
34
  s.add_development_dependency "relish", "= 0.3.0"
35
35
  end
@@ -5,8 +5,8 @@ Feature: Creating a New Project
5
5
 
6
6
  Scenario: Set up your project and verify that you can use CukeSalad
7
7
  Given you are a Step Free Cuker
8
- And you were able to interactively run, the command 'cukesalad' and type 'y'
9
- And you were able to create a file: at 'features/hello_cukesalad.feature' containing
8
+ And you interactively ran, the command 'cukesalad' and typed 'y'
9
+ And you create a file: at 'features/hello_cukesalad.feature' containing
10
10
  """
11
11
  Feature: Hello CukeSalad
12
12
 
@@ -7,32 +7,31 @@ Feature: Define the Role
7
7
  Given you are a Step Free Cuker
8
8
 
9
9
  Scenario: We'll tell you what you need to do to establish the role
10
- Given you did not create a role: called 'NewCustomer'
11
- When you attempt to run a scenario: containing
10
+ When you run a scenario, containing
12
11
  """
13
12
  Given I am a New Customer
14
13
  """
15
14
  Then you should see it has 'failed'
16
15
  And you should see a reply that includes:
17
- """
18
- I can't find a role called 'NewCustomer'. Have you created it?
19
- e.g.
20
- module NewCustomer
21
- end
22
- """
23
-
24
- Scenario: Once you've created the role, you see the step pass
25
- Given you did create a role: called 'NewCustomer'
26
- When you attempt to run a scenario: containing
27
16
  """
28
- Given I am a New Customer
17
+ I can't find a role called 'NewCustomer'. Have you created it?
18
+ e.g.
19
+ module NewCustomer
20
+ end
29
21
  """
22
+
23
+ Scenario: Once you've created the role, you see the step pass
24
+ Given you have created a role, named 'NewCustomer'
25
+ When you run a scenario: containing
26
+ """
27
+ Given I am a New Customer
28
+ """
30
29
  Then you should see it has 'passed'
31
30
 
32
31
  Scenario: Roles which grammatically required an 'an'
33
- Given you did create a role: called 'UnregisteredCustomer'
32
+ Given you have created a role, named 'UnregisteredCustomer'
34
33
  When you attempt to run a scenario: containing
35
- """
36
- Given I am an Unregistered Customer
37
- """
34
+ """
35
+ Given I am an Unregistered Customer
36
+ """
38
37
  Then you should see it has 'passed'
@@ -5,32 +5,31 @@ Feature: Prepare the actor for the role
5
5
 
6
6
  Scenario: Initialization
7
7
  Given you are a Step Free Cuker
8
- And you were able to create a file, at 'features/roles/role_with_prep.rb' containing
9
- """
10
- module RoleWithPrep
11
- def role_preparation
12
- do_something_important
13
- end
8
+ And you have created a file, at 'features/roles/role_with_prep.rb' containing
9
+ """
10
+ module RoleWithPrep
11
+ def role_preparation
12
+ do_something_important
13
+ end
14
14
 
15
- def do_something_important
16
- @something = 'something important was done'
17
- end
15
+ def do_something_important
16
+ @something = 'something important was done'
17
+ end
18
18
 
19
- def see_what_was_done
20
- @something
19
+ def see_what_was_done
20
+ @something
21
+ end
21
22
  end
22
- end
23
- """
24
- And you were able to create a task, called 'see that' containing
25
- """
26
- in_order_to 'see that' do
27
- see_what_was_done
28
- end
29
- """
30
- When you attempt to run a scenario, containing
31
- """
32
- Given I am a Role With Prep
33
- Then I should see that 'something important was done'
34
- """
23
+ """
24
+ And you have created a task, called 'see that' containing
25
+ """
26
+ in_order_to 'see that' do
27
+ see_what_was_done
28
+ end
29
+ """
30
+ When you run a scenario, containing
31
+ """
32
+ Given I am a Role With Prep
33
+ Then I should see that 'something important was done'
34
+ """
35
35
  Then you should see it has 'passed'
36
-
@@ -6,14 +6,13 @@ Feature: Define a Task
6
6
 
7
7
  Background:
8
8
  Given you are a Step Free Cuker
9
- And you were able to create a role: called 'NewCustomer'
9
+ And you have created a role, named 'NewCustomer'
10
10
 
11
11
  Scenario: We'll tell you what you need to do to describe the task
12
- Given you did not create a task: called 'do something'
13
- When you attempt to run a scenario: containing
12
+ When you run a scenario: containing
14
13
  """
15
14
  Given I am a New Customer
16
- And I was able to do something
15
+ When I do something
17
16
  """
18
17
  Then you should see it has 'failed'
19
18
  And you should see a reply that includes:
@@ -21,17 +20,55 @@ Feature: Define a Task
21
20
  I can't find a task called 'do something'. Have you created it?
22
21
  e.g.
23
22
  in_order_to 'do something' do
24
- # the actions
23
+ raise "TODO: You need to explain how to 'do something'"
25
24
  end
26
25
  """
27
26
 
28
- Scenario Outline: Once you've created the task, you see the step pass
29
- Given you were able to create a task: called 'do something'
30
- When you attempt to run a scenario: containing
31
- """
32
- Given I am a New Customer
33
- <step using the task>
34
- """
27
+ Scenario: Once you've created a task, you can use it in a Given step
28
+ Given you have created a task, called 'done something'
29
+ When you run a scenario, containing
30
+ """
31
+ Given I am a New Customer
32
+ And I have done something
33
+ """
34
+ Then you should see it has 'passed'
35
+
36
+ Scenario: Tasks can be used in a When step too
37
+ Given you have created a task, called 'do something'
38
+ When you run a scenario, containing
39
+ """
40
+ Given I am a New Customer
41
+ When I do something
42
+ """
43
+ Then you should see it has 'passed'
44
+
45
+ Scenario: You can reuse a step between a Given and a When step
46
+ Given you have created a task, called 'do something'
47
+ When you run a scenario, containing
48
+ """
49
+ Given I am a New Customer
50
+ And you were able to do something
51
+ When I do something
52
+ """
53
+ Then you should see it has 'passed'
54
+
55
+ Scenario: Tasks can contain numbers
56
+ Given you have created a task: called 'do something for 123Company'
57
+ When you run a scenario: containing
58
+ """
59
+ Given I am a New Customer
60
+ When I do something for 123Company
61
+ """
62
+ Then you should see it has 'passed'
63
+
64
+ Scenario Outline: There are all sorts of ways you can say things
65
+ Given you have created a task, called 'do something'
66
+ And you have created a task, called 'done something'
67
+ When you run a scenario: containing
68
+ """
69
+ Given I am a New Customer
70
+ <step using the task>
71
+ """
35
72
  Then you should see it has 'passed'
36
73
 
37
74
  Examples:
@@ -42,54 +79,13 @@ Feature: Define a Task
42
79
  | Given you were able to do something |
43
80
  | And you were able to do something |
44
81
  | But you did do something |
45
- | When I attempt to do something |
46
- | And I attempt to do something |
82
+ | When I do something |
83
+ | And I do something |
47
84
  | And I did do something |
48
- | When you attempt to do something |
49
- | And you attempt to do something |
85
+ | When you do something |
86
+ | And you do something |
50
87
  | And you did do something |
51
88
  | Then I should do something |
52
89
  | And I should do something |
53
90
  | Then you should do something |
54
91
  | And you should do something |
55
-
56
- Scenario Outline: Once you've created the task, you see the step pass
57
- Given you were able to create a task: called 'do something for 123Company'
58
- When you attempt to run a scenario: containing
59
- """
60
- Given I am a New Customer
61
- <step using the task>
62
- """
63
- Then you should see it has 'passed'
64
-
65
- Examples:
66
- | step using the task |
67
- | Given I was able to do something for 123Company |
68
- | And I was able to do something for 123Company |
69
- | But I did do something for 123Company |
70
- | Given you were able to do something for 123Company |
71
- | And you were able to do something for 123Company |
72
- | But you did do something for 123Company |
73
- | When I attempt to do something for 123Company |
74
- | And I attempt to do something for 123Company |
75
- | And I did do something for 123Company |
76
- | When you attempt to do something for 123Company |
77
- | And you attempt to do something for 123Company |
78
- | And you did do something for 123Company |
79
- | Then I should do something for 123Company |
80
- | And I should do something for 123Company |
81
- | Then you should do something for 123Company |
82
- | And you should do something for 123Company |
83
-
84
- Scenario Outline: Once you've created the task, you see the step pass
85
- Given you were able to create a task: called 'have something'
86
- When you attempt to run a scenario: containing
87
- """
88
- Given I am a New Customer
89
- <step using the task>
90
- """
91
- Then you should see it has 'passed'
92
-
93
- Examples:
94
- | step using the task |
95
- | Given I have something |
@@ -6,7 +6,7 @@ Feature: Define a Task with arguments
6
6
 
7
7
  Background:
8
8
  Given you are a Step Free Cuker
9
- And you were able to create a role: called 'NewCustomer'
9
+ And you have created a role, named 'NewCustomer'
10
10
 
11
11
  Scenario Outline: A task can accept arguments
12
12
  Given you were able to create a task, called 'do some task' containing
@@ -19,12 +19,12 @@ Feature: Define a Task with arguments
19
19
  When you attempt to run a scenario: called 'something' containing
20
20
  """
21
21
  Given I am a New Customer
22
- When I attempt to <task_with_argument>
22
+ When I <do a task with an argument>
23
23
  """
24
24
  Then you should see it has 'passed'
25
25
 
26
26
  Examples:
27
- | task_with_argument |
27
+ | do a task with an argument |
28
28
  | do some task: with 'information' |
29
29
  | do some task, with 'information' |
30
30
  | do some task: with "information" |
@@ -5,22 +5,22 @@ Feature: Remember information between steps
5
5
 
6
6
  Background:
7
7
  Given you are a Step Free Cuker
8
- And you were able to create a role, called 'NewCustomer'
8
+ And you have created a role, named 'NewCustomer'
9
9
 
10
10
  Scenario: You can reuse information
11
- Given you were able to create a task, called 'do something' containing
11
+ Given you have created a task, called 'do something' containing
12
12
  """
13
13
  in_order_to 'do something', remembering: :value do
14
14
  take_note_of :some_key, the( :value )
15
15
  end
16
16
  """
17
- And you were able to create a task, called 'find that the thing remembered was' containing
17
+ And you have created a task, called 'find that the thing remembered was' containing
18
18
  """
19
19
  in_order_to 'find that the thing remembered was' do
20
20
  recall :some_key
21
21
  end
22
22
  """
23
- When you attempt to run a scenario, containing
23
+ When you run a scenario, containing
24
24
  """
25
25
  Given I am a New Customer
26
26
  When I attempt to do something, remembering 'a value'
@@ -30,13 +30,13 @@ Feature: Remember information between steps
30
30
 
31
31
  Scenario: You'll get feedback if you ask for something that wasn't noted
32
32
  Given you did not previously take note of something
33
- And you were able to create a task, called 'find that the thing remembered was' containing
33
+ And you have created a task, called 'find that the thing remembered was' containing
34
34
  """
35
35
  in_order_to 'find that the thing remembered was' do
36
36
  recall :some_key
37
37
  end
38
38
  """
39
- When I attempt to run a scenario, containing
39
+ When I run a scenario, containing
40
40
  """
41
41
  Given I am a New Customer
42
42
  Then I should find that the thing remembered was 'a value'
@@ -46,4 +46,3 @@ Feature: Remember information between steps
46
46
  """
47
47
  You tried to recall ':some_key' but no previous step appears to have taken note of that information
48
48
  """
49
-
@@ -5,32 +5,32 @@ Feature: Expressing expectations
5
5
 
6
6
  Background:
7
7
  Given you are a Step Free Cuker
8
- And you were able to create a file, at 'features/roles/role_with_answers.rb' containing
9
- """
10
- module RoleWithAnswers
11
- def see_the_answer
12
- get_the_answer_from_the_application
13
- end
8
+ And you have created a file, at 'features/roles/role_with_answers.rb' containing
9
+ """
10
+ module RoleWithAnswers
11
+ def see_the_answer
12
+ get_the_answer_from_the_application
13
+ end
14
14
 
15
- def get_the_answer_from_the_application
16
- # Pretending to get the answer from the application
17
- return 'correct answer'
15
+ def get_the_answer_from_the_application
16
+ # Pretending to get the answer from the application
17
+ return 'correct answer'
18
+ end
19
+ end
20
+ """
21
+ And you have created a task, called 'see the answer is' containing
22
+ """
23
+ in_order_to 'see the answer is' do
24
+ see_the_answer
18
25
  end
19
- end
20
- """
21
- And you were able to create a task, called 'see the answer is' containing
22
- """
23
- in_order_to 'see the answer is' do
24
- see_the_answer
25
- end
26
- """
26
+ """
27
27
 
28
28
  Scenario Outline: Simple Expectation
29
- When you attempt to run a scenario, containing
30
- """
31
- Given I am a Role With Answers
32
- Then I should see the answer is <answer>
33
- """
29
+ When you run a scenario, containing
30
+ """
31
+ Given I am a Role With Answers
32
+ Then I should see the answer is <answer>
33
+ """
34
34
  Then you should see it has 'passed'
35
35
 
36
36
  Examples:
@@ -1,3 +1,5 @@
1
- in_order_to "CreateAFile", at: :path, containing: :content do
2
- write_file( the(:path), the(:content ))
1
+ ['create a file', 'created a file'].each do | create_a_new_file |
2
+ in_order_to create_a_new_file, at: :path, containing: :content do
3
+ write_file( the(:path), the(:content ))
4
+ end
3
5
  end
@@ -1,4 +1,3 @@
1
- #TODO: Consider exposing this detail in the examples since it shows you what to do
2
- in_order_to 'create a role', called: :name_of_role do
3
- write_file 'features/lib/roles/my_role.rb', "module #{the :name_of_role}\nend"
1
+ in_order_to 'created a role', named: :role_name do
2
+ write_file 'features/lib/roles/my_role.rb', "module #{the :role_name}\nend"
4
3
  end
@@ -1,12 +1,14 @@
1
- in_order_to 'create a task', called: :name_of_task, containing: :code do
2
- file_name = the( :name_of_task ).gsub(" ", "_")
3
-
4
- default_content =
5
- "in_order_to '#{the :name_of_task}' do
6
- #nothing
7
- end"
8
- content = the :code
9
- content = default_content if content.nil?
1
+ ['create a task', 'created a task'].each do | create_a_new_task |
2
+ in_order_to create_a_new_task, called: :name_of_task, containing: :code do
3
+ file_name = the( :name_of_task ).gsub(" ", "_")
4
+
5
+ default_content =
6
+ "in_order_to '#{the :name_of_task}' do
7
+ #nothing
8
+ end"
9
+ content = the :code
10
+ content = default_content if content.nil?
10
11
 
11
- write_file "features/lib/tasks/#{file_name}.rb", content
12
+ write_file "features/lib/tasks/#{file_name}.rb", content
13
+ end
12
14
  end
@@ -1,4 +1,4 @@
1
- in_order_to "interactively run", the_command: :command, and_type: :answer do
1
+ in_order_to "interactively ran", the_command: :command, and_typed: :answer do
2
2
  @aruba_timeout_seconds = 10
3
3
  run_interactive unescape( the :command )
4
4
  type "#{the :answer}\n"
@@ -1,4 +1,4 @@
1
- in_order_to "RunAScenario", containing: :steps do
1
+ in_order_to 'run a scenario', containing: :steps do
2
2
  write_file 'features/a.feature', "Feature: A Feature
3
3
 
4
4
  Scenario: A Scenario
@@ -11,7 +11,7 @@ Given /^(?:I am|you are) a(?:n)? ([a-zA-Z ]+)$/ do |role|
11
11
  @actor = CukeSalad::Actor.new(role)
12
12
  end
13
13
 
14
- When /^(?:I (?!am)|you (?!are))(?:attempt to |was able to |were able to |did )?((?!should)[A-Z a-z\d_-]*)(?:[:|,] (.*))?:?$/ do | this_task, details, *and_more |
14
+ When /^(?:I (?!am)|you (?!are))(?:attempt to |was able to |were able to |did |have )?((?!should)[A-Z a-z\d_-]*)(?:[:|,] (.*))?:?$/ do | this_task, details, *and_more |
15
15
  info = understand_the details unless details.nil?
16
16
  info[info.keys.last] = and_more[0] unless and_more.empty?
17
17
  @actor.perform this_task, info unless info.nil?
@@ -19,7 +19,7 @@ module CukeSalad
19
19
  begin
20
20
  find_directives_for name
21
21
  rescue NameError
22
- raise "I can't find a task called '#{ something }'. Have you created it?\ne.g.\n in_order_to '#{ something }' do\n # the actions\n end\n\n"
22
+ raise "I can't find a task called '#{ something }'. Have you created it?\ne.g.\n in_order_to '#{ something }' do\n raise \"TODO: You need to explain how to '#{ something }'\"\n end\n\n"
23
23
  end
24
24
  end
25
25
 
@@ -1,3 +1,3 @@
1
1
  module CukeSalad
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cukesalad
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - RiverGlide
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-14 00:00:00 Z
13
+ date: 2011-09-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - "="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.2
22
+ version: 1.0.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: *id001
@@ -63,7 +63,7 @@ dependencies:
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: 0.8.7
66
+ version: 0.9.2
67
67
  type: :development
68
68
  prerelease: false
69
69
  version_requirements: *id005
@@ -93,25 +93,28 @@ files:
93
93
  - Examples/Calculator/Gemfile
94
94
  - Examples/Calculator/Gemfile.lock
95
95
  - Examples/Calculator/README.md
96
+ - Examples/Calculator/Rakefile
96
97
  - Examples/Calculator/cucumber.yml
97
98
  - Examples/Calculator/features/LOOK_MA_NO_STEP_DEFS.txt
99
+ - Examples/Calculator/features/README.md
98
100
  - Examples/Calculator/features/a_place_to_start.feature
99
101
  - Examples/Calculator/features/addition.feature
100
102
  - Examples/Calculator/features/complex_calculations.feature
101
- - Examples/Calculator/features/lib/browser/roles/calculating_web_user.rb
102
- - Examples/Calculator/features/lib/default/roles/calculating_individual.rb
103
- - Examples/Calculator/features/lib/default/tasks/arithmetic/add.rb
104
- - Examples/Calculator/features/lib/default/tasks/arithmetic/calculate.rb
105
- - Examples/Calculator/features/lib/default/tasks/arithmetic/subtract.rb
106
- - Examples/Calculator/features/lib/default/tasks/questions/see_the_answer.rb
107
- - Examples/Calculator/features/lib/default/tasks/reference/calculations.rb
108
- - Examples/Calculator/features/lib/default/tasks/switch_on_the_calculator.rb
103
+ - Examples/Calculator/features/lib/roles/back_door/calculating_individual.rb
104
+ - Examples/Calculator/features/lib/roles/front_door/calculating_individual.rb
105
+ - Examples/Calculator/features/lib/roles/side_door/calculating_individual.rb
106
+ - Examples/Calculator/features/lib/tasks/arithmetic/add.rb
107
+ - Examples/Calculator/features/lib/tasks/arithmetic/calculate.rb
108
+ - Examples/Calculator/features/lib/tasks/arithmetic/subtract.rb
109
+ - Examples/Calculator/features/lib/tasks/questions/see_the_answer.rb
110
+ - Examples/Calculator/features/lib/tasks/reference/calculations.rb
111
+ - Examples/Calculator/features/lib/tasks/switch_on_the_calculator.rb
109
112
  - Examples/Calculator/features/subtraction.feature
110
113
  - Examples/Calculator/features/support/env.rb
111
114
  - Examples/Calculator/features/typical_workflow.feature
112
115
  - Examples/Calculator/lib/calculator.rb
113
- - Examples/Calculator/lib/calculator_operations.rb
114
116
  - Examples/Calculator/lib/config.ru
117
+ - Examples/Calculator/lib/web_calculating_individual.rb
115
118
  - Examples/Calculator/lib/web_calculator.rb
116
119
  - Examples/Calculator/spec/calculator_spec.rb
117
120
  - Examples/Calculator/spec/web_calculator_spec.rb
@@ -183,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
186
  requirements:
184
187
  - - ">="
185
188
  - !ruby/object:Gem::Version
186
- hash: 2889682039650591259
189
+ hash: -189885101072141451
187
190
  segments:
188
191
  - 0
189
192
  version: "0"
@@ -192,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
195
  requirements:
193
196
  - - ">="
194
197
  - !ruby/object:Gem::Version
195
- hash: 2889682039650591259
198
+ hash: -189885101072141451
196
199
  segments:
197
200
  - 0
198
201
  version: "0"
@@ -1,4 +0,0 @@
1
- module CalculatorOperations
2
- OPERATORS = { '+' => :plus, '-' => :minus, '=' => :equals }
3
- OPERATIONS = { 'plus' => :+, 'minus' => :-, 'equals' => '=' }
4
- end