Browse files

Initialising the actor: Found, tested and corrected sequencing issue …

…with actor preparation
  • Loading branch information...
1 parent 3b2d980 commit c948146a0462c50de11c59e410453ad21ddb2115 @antonymarcano antonymarcano committed Jul 3, 2011
View
2 Examples/Calculator/Gemfile
@@ -1,5 +1,5 @@
source :rubygems
-gem "cukesalad", ">=0.6"
+gem "cukesalad", ">=0.7"
gem "rspec", ">=2.5.0", :require => 'spec'
gem "capybara", ">=0.4.1.2"
gem "sinatra", ">=1.2.0"
View
51 Examples/Calculator/Gemfile.lock
@@ -1,64 +1,65 @@
GEM
remote: http://rubygems.org/
specs:
- aruba (0.3.6)
- childprocess (>= 0.1.7)
- cucumber (>= 0.10.0)
- rspec (>= 2.5.0)
+ aruba (0.4.3)
+ bcat (>= 0.6.1)
+ childprocess (>= 0.1.9)
+ cucumber (>= 0.10.7)
+ rdiscount (>= 1.6.8)
+ rspec (>= 2.6.0)
+ bcat (0.6.1)
+ rack (~> 1.0)
builder (3.0.0)
- capybara (0.4.1.2)
- celerity (>= 0.7.9)
- culerity (>= 0.2.4)
+ capybara (1.0.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
- selenium-webdriver (>= 0.0.27)
- xpath (~> 0.1.3)
- celerity (0.8.9)
+ selenium-webdriver (~> 0.2.0)
+ xpath (~> 0.1.4)
childprocess (0.1.9)
ffi (~> 1.0.6)
- cucumber (0.10.2)
+ cucumber (1.0.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (>= 2.3.5)
+ gherkin (~> 2.4.1)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
- cukesalad (0.6.1)
+ cukesalad (0.7.0)
aruba (>= 0.3.5)
cucumber (>= 0.10.0)
rspec (>= 2.5.0)
- culerity (0.2.15)
diff-lcs (1.1.2)
- ffi (1.0.8)
- gherkin (2.3.8)
+ ffi (1.0.9)
+ gherkin (2.4.1)
json (>= 1.4.6)
- json (1.5.1)
- json_pure (1.5.1)
+ json (1.5.3)
+ json_pure (1.5.3)
mime-types (1.16)
- nokogiri (1.4.4)
- rack (1.2.2)
+ nokogiri (1.5.0)
+ rack (1.3.0)
rack-test (0.6.0)
rack (>= 1.0)
+ rdiscount (1.6.8)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
- rspec-core (2.6.0)
+ rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rubyzip (0.9.4)
- selenium-webdriver (0.2.0)
- childprocess (>= 0.1.7)
+ selenium-webdriver (0.2.2)
+ childprocess (>= 0.1.9)
ffi (>= 1.0.7)
json_pure
rubyzip
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
term-ansicolor (1.0.5)
- tilt (1.3)
+ tilt (1.3.2)
xpath (0.1.4)
nokogiri (~> 1.3)
@@ -67,6 +68,6 @@ PLATFORMS
DEPENDENCIES
capybara (>= 0.4.1.2)
- cukesalad (>= 0.6)
+ cukesalad (>= 0.7)
rspec (>= 2.5.0)
sinatra (>= 1.2.0)
View
1 Examples/Calculator/features/addition.feature
@@ -5,7 +5,6 @@ Feature: Addition
Scenario Outline: Find the sum of two numbers
Given I am a Calculating Individual
- And I was able to switch on the calculator
When I attempt to add: the number '<first_number>' and the number '<second_number>'
Then I should see the answer '<result>'
View
1 Examples/Calculator/features/complex_calculations.feature
@@ -5,7 +5,6 @@ Feature: Complex Calculations
Scenario Outline: Get the result of a more complex calculation
Given I am a calculating individual
- And I was able to switch on the calculator
When I attempt to calculate, with the following '<calculation>'
Then I should see the answer '<correct_result>'
View
25 Examples/Calculator/features/lib/alternative/roles/calculating_web_user.rb
@@ -10,39 +10,22 @@
module CalculatingIndividual
- # Uses a Browser to perform its tasks
include Capybara
- # This is not a page object. It is a WebUser, specialised to our application
- # See the comments in the 'enter' and 'press' method for an explanation of why
+
+ def role_preparation
+ switch_on_the_calculator
+ end
def switch_on_the_calculator
visit '/'
end
def enter value
fill_in 'number', :with => value
- # Because the calculator is a simple web_app with only
- # one page we can put the id for the field here. In a more complex web-app
- # we would pass in the id of the thing to enter
- # The task would express the action as: enter( :the_number, "10")
- # Because we can change the id used in our application,
- # we would just change the id in the application to be 'the_number'.
- # If we were on a project where we could not change the id
- # in the application we would write an 'ApplicationExpert'
- # to map :the_number to the id for the field 'number'. Our CalculatingIndividual
- # would ask the ApplicationExpert for the id of the symbol :the_number
- # See 'press' below for am explanation of how an ApplicationExpert
- # would work
end
def press operator
click_button operator.to_s
- # Here, our 'operator' happens to also match the id for the button.
- # If we were on a project where we could not choose what the id
- # was for buttons, we would write an ApplicationExpert to map
- # the symbol used in the task to the symbol for that button.
- # The ApplicationExpert would only need to know what page it
- # was on to find a mappings class (or yml file) for the fields on that page.
end
def look_at_the_display
View
4 Examples/Calculator/features/lib/default/roles/calculating_individual.rb
@@ -2,6 +2,10 @@
module CalculatingIndividual
+ def role_preparation
+ switch_on_the_calculator
+ end
+
def switch_on_the_calculator
@calculator = Calculator.new
@operate_with = {
View
1 Examples/Calculator/features/subtraction.feature
@@ -5,7 +5,6 @@ Feature: Subtraction
Scenario Outline: Find the result of subtracting two numbers
Given I am a Calculating Individual
- And I was able to switch on the calculator
When I attempt to subtract, the number '<subtractor>' from the number '<subtractee>'
Then I should see the answer '<result>'
View
1 Examples/Calculator/features/typical_workflow.feature
@@ -5,7 +5,6 @@ Feature: Typical Calculator Workflow
Scenario Outline: See what I expect based on specific interactions
Given I am a calculating individual
- And I was able to switch on the calculator
When I attempt to calculate: with the following '<interactions>'
Then I should see the answer '<expected>'
View
28 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- cukesalad (0.6.1)
+ cukesalad (0.7.0)
aruba (>= 0.3.5)
cucumber (>= 0.10.0)
rspec (>= 2.5.0)
@@ -10,41 +10,47 @@ GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
- aruba (0.3.6)
- childprocess (>= 0.1.7)
- cucumber (>= 0.10.0)
- rspec (>= 2.5.0)
+ aruba (0.4.3)
+ bcat (>= 0.6.1)
+ childprocess (>= 0.1.9)
+ cucumber (>= 0.10.7)
+ rdiscount (>= 1.6.8)
+ rspec (>= 2.6.0)
+ bcat (0.6.1)
+ rack (~> 1.0)
builder (3.0.0)
childprocess (0.1.9)
ffi (~> 1.0.6)
- cucumber (0.10.3)
+ cucumber (1.0.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (>= 2.3.8)
+ gherkin (~> 2.4.1)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
diff-lcs (1.1.2)
ffi (1.0.9)
ffi (1.0.9-java)
- gherkin (2.3.10)
+ gherkin (2.4.1)
json (>= 1.4.6)
- gherkin (2.3.10-java)
+ gherkin (2.4.1-java)
json (>= 1.4.6)
json (1.4.6)
json (1.4.6-java)
mime-types (1.16)
+ rack (1.3.0)
rake (0.8.7)
+ rdiscount (1.6.8)
relish (0.3.0)
archive-tar-minitar (~> 0.5.2)
json (~> 1.4.6)
rest-client (~> 1.6.1)
- rest-client (1.6.1)
+ rest-client (1.6.3)
mime-types (>= 1.16)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
- rspec-core (2.6.3)
+ rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
View
2 VERSION
@@ -1 +1 @@
-0.6.0
+0.7.0
View
1 features/define_a_role.feature
@@ -5,7 +5,6 @@ Feature: Define the Role
Background:
Given you are a Step Free Cuker
- And you were able to create a new Cuke Salad project
Scenario: We'll tell you what you need to do to establish the role
Given you did not create a role: called 'NewCustomer'
View
3 features/define_a_task.feature
@@ -6,11 +6,10 @@ Feature: Define the Task
Background:
Given you are a Step Free Cuker
- And you were able to create a new Cuke Salad project
And you were able to create a role: called 'NewCustomer'
Scenario Outline: Once you've created the task, you see the step pass
- Given you did create a task: called 'do something'
+ Given you were able to create a task: called 'do something'
When you attempt to run a scenario: containing
"""
Given I am a New Customer
View
1 features/define_a_task_with_arguments.feature
@@ -6,7 +6,6 @@ Feature: Define a Task with arguments
Background:
Given you are a Step Free Cuker
- And you were able to create a new Cuke Salad project
And you were able to create a role: called 'NewCustomer'
Scenario Outline: A task can accept arguments
View
15 features/lib/roles/step_free_cuker.rb
@@ -2,4 +2,19 @@
#TODO: Consider wrapping Aruba
module StepFreeCuker
include Aruba::Api
+
+ def role_preparation
+ create_a_new_cuke_salad_project
+ end
+
+ def create_a_new_cuke_salad_project
+ create_dir 'features'
+ create_dir 'features/support'
+ write_file 'features/support/env.rb', "$:.unshift(File.dirname(__FILE__) + '/../../../../lib') #where to find CukeSalad
+
+ require 'cukesalad'"
+ create_dir 'features/lib'
+ create_dir 'features/lib/roles'
+ create_dir 'features/lib/tasks'
+ end
end
View
10 features/lib/tasks/create_a_new_cukesalad_project.rb
@@ -1,11 +1,3 @@
-#TOOO: consider doing this as a feature since it's part of how you set up the project.
in_order_to "CreateANewCukeSaladProject" do
- create_dir 'features'
- create_dir 'features/support'
- write_file 'features/support/env.rb', "$:.unshift(File.dirname(__FILE__) + '/../../../../lib') #where to find CukeSalad
-
- require 'cukesalad'"
- create_dir 'features/lib'
- create_dir 'features/lib/roles'
- create_dir 'features/lib/tasks'
+ create_a_new_cuke_salad_project
end
View
1 features/prepare_the_actor_for_the_role.feature
@@ -5,7 +5,6 @@ Feature: Prepare the actor for the role
Background:
Given you are a Step Free Cuker
- And you were able to create a new Cuke Salad project
Scenario: Initialization
Given you were able to create a file, at 'features/roles/role_with_prep.rb' containing
View
1 features/remember_information_between_steps.feature
@@ -5,7 +5,6 @@ Feature: Remember information between steps
Background:
Given you are a Step Free Cuker
- And you were able to create a new Cuke Salad project
And you were able to create a role, called 'NewCustomer'
Scenario: You can reuse information
View
2 lib/cukesalad/actor.rb
@@ -19,6 +19,7 @@ def perform described_task, details = {}
def get_into_character_for described_role
the_role = @director.explain_the_role described_role
see_how_to_do the_role
+ role_preparation
end
def get_ready_to_perform something
@@ -28,7 +29,6 @@ def get_ready_to_perform something
def see_how_to_do something
extend something
- role_preparation
end
def role_preparation
View
2 lib/cukesalad/version.rb
@@ -1,3 +1,3 @@
module CukeSalad
- VERSION = "0.6.1"
+ VERSION = "0.7.0"
end

0 comments on commit c948146

Please sign in to comment.