cukesalad 0.8.0 → 0.8.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.
- data/Examples/Calculator/Gemfile +1 -1
- data/Examples/Calculator/Gemfile.lock +7 -7
- data/Examples/Calculator/README.md +12 -4
- data/Examples/Calculator/Rakefile +42 -0
- data/Examples/Calculator/cucumber.yml +4 -2
- data/Examples/Calculator/features/README.md +18 -0
- data/Examples/Calculator/features/a_place_to_start.feature +1 -1
- data/Examples/Calculator/features/complex_calculations.feature +1 -1
- data/Examples/Calculator/features/lib/{default/roles → roles/back_door}/calculating_individual.rb +1 -2
- data/Examples/Calculator/features/lib/roles/front_door/calculating_individual.rb +11 -0
- data/Examples/Calculator/features/lib/roles/side_door/calculating_individual.rb +11 -0
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/add.rb +0 -0
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/calculate.rb +0 -0
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/arithmetic/subtract.rb +0 -0
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/questions/see_the_answer.rb +0 -0
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/reference/calculations.rb +2 -3
- data/Examples/Calculator/features/lib/{default/tasks → tasks}/switch_on_the_calculator.rb +0 -0
- data/Examples/Calculator/features/typical_workflow.feature +1 -1
- data/Examples/Calculator/lib/calculator.rb +3 -0
- data/Examples/Calculator/{features/lib/browser/roles/calculating_web_user.rb → lib/web_calculating_individual.rb} +2 -11
- data/Examples/Calculator/lib/web_calculator.rb +1 -2
- data/Gemfile.lock +10 -13
- data/VERSION +1 -1
- data/cukesalad.gemspec +2 -2
- data/features/creating_a_new_project.feature +2 -2
- data/features/defining_roles/define_a_role.feature +16 -17
- data/features/defining_roles/prepare_the_actor_for_the_role.feature +24 -25
- data/features/defining_tasks/define_a_task.feature +53 -57
- data/features/defining_tasks/define_a_task_with_arguments.feature +3 -3
- data/features/defining_tasks/remember_information_between_steps.feature +6 -7
- data/features/expectations/expressing_expectations.feature +22 -22
- data/features/lib/tasks/create_a_file.rb +4 -2
- data/features/lib/tasks/create_a_role.rb +2 -3
- data/features/lib/tasks/create_a_task.rb +12 -10
- data/features/lib/tasks/interactively_run.rb +1 -1
- data/features/lib/tasks/run_a_scenario.rb +1 -1
- data/lib/cukesalad/cucumber_steps.rb +1 -1
- data/lib/cukesalad/director.rb +1 -1
- data/lib/cukesalad/version.rb +1 -1
- metadata +18 -15
- data/Examples/Calculator/lib/calculator_operations.rb +0 -4
data/Examples/Calculator/Gemfile
CHANGED
@@ -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.
|
23
|
+
cucumber (1.0.6)
|
24
24
|
builder (>= 2.1.2)
|
25
25
|
diff-lcs (>= 1.1.2)
|
26
|
-
gherkin (~> 2.4.
|
26
|
+
gherkin (~> 2.4.18)
|
27
27
|
json (>= 1.4.6)
|
28
|
-
term-ansicolor (>= 1.0.
|
29
|
-
cukesalad (0.8.
|
28
|
+
term-ansicolor (>= 1.0.6)
|
29
|
+
cukesalad (0.8.1)
|
30
30
|
aruba (= 0.4.3)
|
31
|
-
cucumber (= 1.0.
|
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.
|
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.
|
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
|
-
|
11
|
+
rake check:features
|
12
12
|
|
13
|
-
To run these via a web
|
13
|
+
To run these via a web browser, use:
|
14
14
|
|
15
|
-
|
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:
|
2
|
-
front_door:
|
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,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
|
8
|
+
When I calculate, with the following '<calculation>'
|
9
9
|
Then I should see the answer '<correct_result>'
|
10
10
|
|
11
11
|
Examples:
|
data/Examples/Calculator/features/lib/{default/roles → roles/back_door}/calculating_individual.rb
RENAMED
@@ -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 =
|
11
|
+
@operate_with = Calculator::OPERATIONS
|
13
12
|
end
|
14
13
|
|
15
14
|
def enter value
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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 =
|
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
|
File without changes
|
@@ -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
|
8
|
+
When I calculate, with the following '<interactions>'
|
9
9
|
Then I should see the answer '<expected>'
|
10
10
|
|
11
11
|
Examples:
|
@@ -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
|
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
|
-
|
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.
|
4
|
+
cukesalad (0.8.1)
|
5
5
|
aruba (= 0.4.3)
|
6
|
-
cucumber (= 1.0.
|
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.
|
24
|
+
cucumber (1.0.6)
|
25
25
|
builder (>= 2.1.2)
|
26
26
|
diff-lcs (>= 1.1.2)
|
27
|
-
gherkin (~> 2.4.
|
27
|
+
gherkin (~> 2.4.18)
|
28
28
|
json (>= 1.4.6)
|
29
|
-
term-ansicolor (>= 1.0.
|
29
|
+
term-ansicolor (>= 1.0.6)
|
30
30
|
diff-lcs (1.1.3)
|
31
31
|
ffi (1.0.9)
|
32
|
-
|
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.
|
41
|
-
rake (0.
|
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.
|
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.
|
63
|
+
rake (~> 0.9.2)
|
67
64
|
relish (= 0.3.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
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.
|
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.
|
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
|
9
|
-
And you
|
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
|
-
|
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
|
-
|
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
|
32
|
+
Given you have created a role, named 'UnregisteredCustomer'
|
34
33
|
When you attempt to run a scenario: containing
|
35
|
-
|
36
|
-
|
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
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def do_something_important
|
16
|
+
@something = 'something important was done'
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
def see_what_was_done
|
20
|
+
@something
|
21
|
+
end
|
21
22
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
23
|
+
raise "TODO: You need to explain how to 'do something'"
|
25
24
|
end
|
26
25
|
"""
|
27
26
|
|
28
|
-
Scenario
|
29
|
-
Given you
|
30
|
-
When
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
46
|
-
| And I
|
82
|
+
| When I do something |
|
83
|
+
| And I do something |
|
47
84
|
| And I did do something |
|
48
|
-
| When you
|
49
|
-
| And you
|
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
|
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
|
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
|
-
|
|
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
|
8
|
+
And you have created a role, named 'NewCustomer'
|
9
9
|
|
10
10
|
Scenario: You can reuse information
|
11
|
-
Given you
|
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
|
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
|
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
|
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
|
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
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
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
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
2
|
-
|
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
|
-
|
2
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
+
write_file "features/lib/tasks/#{file_name}.rb", content
|
13
|
+
end
|
12
14
|
end
|
@@ -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?
|
data/lib/cukesalad/director.rb
CHANGED
@@ -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 #
|
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
|
|
data/lib/cukesalad/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cukesalad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
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-
|
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.
|
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.
|
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/
|
102
|
-
- Examples/Calculator/features/lib/
|
103
|
-
- Examples/Calculator/features/lib/
|
104
|
-
- Examples/Calculator/features/lib/
|
105
|
-
- Examples/Calculator/features/lib/
|
106
|
-
- Examples/Calculator/features/lib/
|
107
|
-
- Examples/Calculator/features/lib/
|
108
|
-
- Examples/Calculator/features/lib/
|
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:
|
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:
|
198
|
+
hash: -189885101072141451
|
196
199
|
segments:
|
197
200
|
- 0
|
198
201
|
version: "0"
|