cukesalad 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/Examples/Calculator/Gemfile +4 -5
- data/Examples/Calculator/Gemfile.lock +30 -33
- data/Examples/Calculator/features/lib/default/tasks/{add.rb → arithmetic/add.rb} +0 -0
- data/Examples/Calculator/features/lib/default/tasks/{calculate.rb → arithmetic/calculate.rb} +0 -0
- data/Examples/Calculator/features/lib/default/tasks/{subtract.rb → arithmetic/subtract.rb} +0 -0
- data/Examples/Calculator/features/lib/default/tasks/{see_the_answer.rb → questions/see_the_answer.rb} +0 -0
- data/Examples/Calculator/features/lib/default/tasks/{calculations.rb → reference/calculations.rb} +0 -0
- data/Gemfile +2 -7
- data/Gemfile.lock +29 -29
- data/Rakefile +1 -21
- data/cukesalad.gemspec +29 -0
- data/features/define_a_task.feature +17 -17
- data/features/remember_information_between_steps.feature +5 -5
- data/features/support/env.rb +0 -2
- data/lib/cukesalad.rb +2 -36
- data/lib/cukesalad/actor.rb +49 -0
- data/lib/cukesalad/codify/const_name.rb +23 -0
- data/lib/cukesalad/cucumber.rb +35 -0
- data/lib/cukesalad/director.rb +30 -0
- data/lib/cukesalad/salad.rb +3 -0
- data/lib/cukesalad/specifics.rb +36 -0
- data/lib/cukesalad/task_author.rb +21 -0
- data/lib/cukesalad/version.rb +3 -0
- data/spec/cukesalad/actor_spec.rb +96 -0
- data/spec/cukesalad/codify/as_const_name_spec.rb +30 -0
- data/spec/cukesalad/director_spec.rb +36 -0
- data/spec/cukesalad/specifics_spec.rb +68 -0
- data/spec/cukesalad/task_author_spec.rb +52 -0
- data/spec/spec_helper.rb +1 -4
- metadata +62 -59
- data/examples/Calculator/features/lib/alternative/roles/calculating_web_user.rb +0 -55
- data/examples/Calculator/features/lib/default/roles/calculating_individual.rb +0 -32
- data/examples/Calculator/features/lib/default/tasks/add.rb +0 -6
- data/examples/Calculator/features/lib/default/tasks/calculate.rb +0 -4
- data/examples/Calculator/features/lib/default/tasks/calculations.rb +0 -15
- data/examples/Calculator/features/lib/default/tasks/see_the_answer.rb +0 -3
- data/examples/Calculator/features/lib/default/tasks/subtract.rb +0 -4
- data/examples/Calculator/features/lib/default/tasks/switch_on_the_calculator.rb +0 -9
- data/examples/Calculator/features/support/env.rb +0 -5
- data/examples/Calculator/lib/calculator.rb +0 -53
- data/examples/Calculator/lib/web_calculator.rb +0 -82
- data/examples/Calculator/spec/calculator_spec.rb +0 -73
- data/examples/Calculator/spec/web_calculator_spec.rb +0 -99
- data/lib/actor.rb +0 -47
- data/lib/codify/const_name.rb +0 -21
- data/lib/director.rb +0 -28
- data/lib/specifics.rb +0 -34
- data/lib/task_author.rb +0 -12
- data/spec/actor_spec.rb +0 -96
- data/spec/codify/as_const_name_spec.rb +0 -28
- data/spec/director_spec.rb +0 -34
- data/spec/specifics_spec.rb +0 -67
- data/spec/task_author_spec.rb +0 -50
data/spec/spec_helper.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.6.
|
5
|
+
version: 0.6.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- RiverGlide
|
@@ -10,14 +10,15 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-19 00:00:00 +01:00
|
14
|
+
default_executable: cukesalad
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: cucumber
|
17
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
20
|
requirements:
|
20
|
-
- - "
|
21
|
+
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
23
|
version: 0.10.0
|
23
24
|
type: :runtime
|
@@ -28,7 +29,7 @@ dependencies:
|
|
28
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
31
|
requirements:
|
31
|
-
- - "
|
32
|
+
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: 2.5.0
|
34
35
|
type: :runtime
|
@@ -39,7 +40,7 @@ dependencies:
|
|
39
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
42
|
-
- - "
|
43
|
+
- - ">="
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: 0.3.5
|
45
46
|
type: :runtime
|
@@ -57,26 +58,27 @@ dependencies:
|
|
57
58
|
prerelease: false
|
58
59
|
version_requirements: *id004
|
59
60
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
61
|
+
name: rake
|
61
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
62
63
|
none: false
|
63
64
|
requirements:
|
64
65
|
- - ~>
|
65
66
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
67
|
+
version: 0.8.7
|
67
68
|
type: :development
|
68
69
|
prerelease: false
|
69
70
|
version_requirements: *id005
|
70
71
|
description: CukeSalad allows you to focus on the tasks at hand - expressing examples, the roles involved in those examples and the tasks that those roles need to perform with the product under development.
|
71
|
-
email:
|
72
|
+
email:
|
73
|
+
- talktous@riverglide.com
|
72
74
|
executables:
|
73
75
|
- cukesalad
|
74
76
|
extensions: []
|
75
77
|
|
76
|
-
extra_rdoc_files:
|
77
|
-
|
78
|
-
- README.md
|
78
|
+
extra_rdoc_files: []
|
79
|
+
|
79
80
|
files:
|
81
|
+
- .gitignore
|
80
82
|
- .rspec
|
81
83
|
- Examples/Calculator/Gemfile
|
82
84
|
- Examples/Calculator/Gemfile.lock
|
@@ -87,11 +89,11 @@ files:
|
|
87
89
|
- Examples/Calculator/features/complex_calculations.feature
|
88
90
|
- Examples/Calculator/features/lib/alternative/roles/calculating_web_user.rb
|
89
91
|
- Examples/Calculator/features/lib/default/roles/calculating_individual.rb
|
90
|
-
- Examples/Calculator/features/lib/default/tasks/add.rb
|
91
|
-
- Examples/Calculator/features/lib/default/tasks/calculate.rb
|
92
|
-
- Examples/Calculator/features/lib/default/tasks/
|
93
|
-
- Examples/Calculator/features/lib/default/tasks/see_the_answer.rb
|
94
|
-
- Examples/Calculator/features/lib/default/tasks/
|
92
|
+
- Examples/Calculator/features/lib/default/tasks/arithmetic/add.rb
|
93
|
+
- Examples/Calculator/features/lib/default/tasks/arithmetic/calculate.rb
|
94
|
+
- Examples/Calculator/features/lib/default/tasks/arithmetic/subtract.rb
|
95
|
+
- Examples/Calculator/features/lib/default/tasks/questions/see_the_answer.rb
|
96
|
+
- Examples/Calculator/features/lib/default/tasks/reference/calculations.rb
|
95
97
|
- Examples/Calculator/features/lib/default/tasks/switch_on_the_calculator.rb
|
96
98
|
- Examples/Calculator/features/subtraction.feature
|
97
99
|
- Examples/Calculator/features/support/env.rb
|
@@ -109,6 +111,7 @@ files:
|
|
109
111
|
- VERSION
|
110
112
|
- bin/cukesalad
|
111
113
|
- cucumber.yml
|
114
|
+
- cukesalad.gemspec
|
112
115
|
- features/a_new_cukesalad_project.feature
|
113
116
|
- features/define_a_role.feature
|
114
117
|
- features/define_a_task.feature
|
@@ -128,33 +131,24 @@ files:
|
|
128
131
|
- features/lib/tasks/see_the_step_has.rb
|
129
132
|
- features/remember_information_between_steps.feature
|
130
133
|
- features/support/env.rb
|
131
|
-
- lib/actor.rb
|
132
|
-
- lib/codify/const_name.rb
|
133
134
|
- lib/cukesalad.rb
|
135
|
+
- lib/cukesalad/actor.rb
|
134
136
|
- lib/cukesalad/cli.rb
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
-
|
139
|
-
-
|
137
|
+
- lib/cukesalad/codify/const_name.rb
|
138
|
+
- lib/cukesalad/cucumber.rb
|
139
|
+
- lib/cukesalad/director.rb
|
140
|
+
- lib/cukesalad/salad.rb
|
141
|
+
- lib/cukesalad/specifics.rb
|
142
|
+
- lib/cukesalad/task_author.rb
|
143
|
+
- lib/cukesalad/version.rb
|
144
|
+
- spec/cukesalad/actor_spec.rb
|
140
145
|
- spec/cukesalad/cli_spec.rb
|
141
|
-
- spec/
|
146
|
+
- spec/cukesalad/codify/as_const_name_spec.rb
|
147
|
+
- spec/cukesalad/director_spec.rb
|
148
|
+
- spec/cukesalad/specifics_spec.rb
|
149
|
+
- spec/cukesalad/task_author_spec.rb
|
142
150
|
- spec/spec_helper.rb
|
143
|
-
|
144
|
-
- spec/task_author_spec.rb
|
145
|
-
- examples/Calculator/features/lib/alternative/roles/calculating_web_user.rb
|
146
|
-
- examples/Calculator/features/lib/default/roles/calculating_individual.rb
|
147
|
-
- examples/Calculator/features/lib/default/tasks/add.rb
|
148
|
-
- examples/Calculator/features/lib/default/tasks/calculate.rb
|
149
|
-
- examples/Calculator/features/lib/default/tasks/calculations.rb
|
150
|
-
- examples/Calculator/features/lib/default/tasks/see_the_answer.rb
|
151
|
-
- examples/Calculator/features/lib/default/tasks/subtract.rb
|
152
|
-
- examples/Calculator/features/lib/default/tasks/switch_on_the_calculator.rb
|
153
|
-
- examples/Calculator/features/support/env.rb
|
154
|
-
- examples/Calculator/lib/calculator.rb
|
155
|
-
- examples/Calculator/lib/web_calculator.rb
|
156
|
-
- examples/Calculator/spec/calculator_spec.rb
|
157
|
-
- examples/Calculator/spec/web_calculator_spec.rb
|
151
|
+
has_rdoc: true
|
158
152
|
homepage: https://github.com/RiverGlide/CukeSalad
|
159
153
|
licenses:
|
160
154
|
- MIT
|
@@ -168,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
162
|
requirements:
|
169
163
|
- - ">="
|
170
164
|
- !ruby/object:Gem::Version
|
171
|
-
hash: -
|
165
|
+
hash: -3357820802428433430
|
172
166
|
segments:
|
173
167
|
- 0
|
174
168
|
version: "0"
|
@@ -177,32 +171,41 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
171
|
requirements:
|
178
172
|
- - ">="
|
179
173
|
- !ruby/object:Gem::Version
|
174
|
+
hash: -3357820802428433430
|
175
|
+
segments:
|
176
|
+
- 0
|
180
177
|
version: "0"
|
181
178
|
requirements: []
|
182
179
|
|
183
180
|
rubyforge_project:
|
184
|
-
rubygems_version: 1.
|
181
|
+
rubygems_version: 1.6.1
|
185
182
|
signing_key:
|
186
183
|
specification_version: 3
|
187
184
|
summary: Friction Free BDD/ATDD with cucumber
|
188
185
|
test_files:
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
-
|
198
|
-
-
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
186
|
+
- features/a_new_cukesalad_project.feature
|
187
|
+
- features/define_a_role.feature
|
188
|
+
- features/define_a_task.feature
|
189
|
+
- features/define_a_task_with_arguments.feature
|
190
|
+
- features/lib/roles/step_free_cuker.rb
|
191
|
+
- features/lib/tasks/create_a_file.rb
|
192
|
+
- features/lib/tasks/create_a_new_cukesalad_project.rb
|
193
|
+
- features/lib/tasks/create_a_role.rb
|
194
|
+
- features/lib/tasks/create_a_task.rb
|
195
|
+
- features/lib/tasks/create_directories.rb
|
196
|
+
- features/lib/tasks/not_create_a_role.rb
|
197
|
+
- features/lib/tasks/not_create_a_task.rb
|
198
|
+
- features/lib/tasks/not_previously_take_note_of_something.rb
|
199
|
+
- features/lib/tasks/run.rb
|
200
|
+
- features/lib/tasks/run_a_scenario.rb
|
201
|
+
- features/lib/tasks/see_a_reply.rb
|
202
|
+
- features/lib/tasks/see_the_step_has.rb
|
203
|
+
- features/remember_information_between_steps.feature
|
204
|
+
- features/support/env.rb
|
205
|
+
- spec/cukesalad/actor_spec.rb
|
204
206
|
- spec/cukesalad/cli_spec.rb
|
205
|
-
- spec/
|
207
|
+
- spec/cukesalad/codify/as_const_name_spec.rb
|
208
|
+
- spec/cukesalad/director_spec.rb
|
209
|
+
- spec/cukesalad/specifics_spec.rb
|
210
|
+
- spec/cukesalad/task_author_spec.rb
|
206
211
|
- spec/spec_helper.rb
|
207
|
-
- spec/specifics_spec.rb
|
208
|
-
- spec/task_author_spec.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# To run with this version of the Calculating Individual:
|
2
|
-
# cucumber --profile alternative
|
3
|
-
|
4
|
-
require 'web_calculator'
|
5
|
-
require 'capybara'
|
6
|
-
require 'capybara/dsl'
|
7
|
-
|
8
|
-
Capybara.app = WebCalculator
|
9
|
-
Capybara.default_driver = :rack_test
|
10
|
-
|
11
|
-
module CalculatingIndividual
|
12
|
-
|
13
|
-
# Uses a Browser to perform its tasks
|
14
|
-
include Capybara
|
15
|
-
# This is not a page object. It is a WebUser, specialised to our application
|
16
|
-
# See the comments in the 'enter' and 'press' method for an explanation of why
|
17
|
-
|
18
|
-
def switch_on_the_calculator
|
19
|
-
visit '/'
|
20
|
-
end
|
21
|
-
|
22
|
-
def enter value
|
23
|
-
fill_in 'number', :with => value
|
24
|
-
# Because the calculator is a simple web_app with only
|
25
|
-
# one page we can put the id for the field here. In a more complex web-app
|
26
|
-
# we would pass in the id of the thing to enter
|
27
|
-
# The task would express the action as: enter( :the_number, "10")
|
28
|
-
# Because we can change the id used in our application,
|
29
|
-
# we would just change the id in the application to be 'the_number'.
|
30
|
-
# If we were on a project where we could not change the id
|
31
|
-
# in the application we would write an 'ApplicationExpert'
|
32
|
-
# to map :the_number to the id for the field 'number'. Our CalculatingIndividual
|
33
|
-
# would ask the ApplicationExpert for the id of the symbol :the_number
|
34
|
-
# See 'press' below for am explanation of how an ApplicationExpert
|
35
|
-
# would work
|
36
|
-
end
|
37
|
-
|
38
|
-
def press operator
|
39
|
-
click_button operator.to_s
|
40
|
-
# Here, our 'operator' happens to also match the id for the button.
|
41
|
-
# If we were on a project where we could not choose what the id
|
42
|
-
# was for buttons, we would write an ApplicationExpert to map
|
43
|
-
# the symbol used in the task to the symbol for that button.
|
44
|
-
# The ApplicationExpert would only need to know what page it
|
45
|
-
# was on to find a mappings class (or yml file) for the fields on that page.
|
46
|
-
end
|
47
|
-
|
48
|
-
def look_at_the_display
|
49
|
-
find_field('display').value.to_i
|
50
|
-
end
|
51
|
-
|
52
|
-
def is_the_calculator_ready?
|
53
|
-
page.body.should =~ /Calculator is Ready!/
|
54
|
-
end
|
55
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'calculator'
|
2
|
-
|
3
|
-
module CalculatingIndividual
|
4
|
-
|
5
|
-
def switch_on_the_calculator
|
6
|
-
@calculator = Calculator.new
|
7
|
-
@operate_with = {
|
8
|
-
plus: :+,
|
9
|
-
minus: :-
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
def enter value
|
14
|
-
@calculator.enter value.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
def press next_operator
|
18
|
-
if next_operator == :equals
|
19
|
-
equals
|
20
|
-
else
|
21
|
-
@calculator.get_ready_to @operate_with[next_operator]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def equals
|
26
|
-
@calculator.equals
|
27
|
-
end
|
28
|
-
|
29
|
-
def look_at_the_display
|
30
|
-
@calculator.display
|
31
|
-
end
|
32
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Calculations
|
2
|
-
|
3
|
-
def follow_the_steps_for sum
|
4
|
-
enter_numbers_and_operators_for sum
|
5
|
-
end
|
6
|
-
|
7
|
-
def enter_numbers_and_operators_for sum
|
8
|
-
operator = {"+" => :plus, "-" => :minus, "=" => :equals}
|
9
|
-
sum.each do | token |
|
10
|
-
enter token.to_i if token =~ /\d+/
|
11
|
-
press operator[token] if operator.include? token
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
@@ -1,53 +0,0 @@
|
|
1
|
-
|
2
|
-
class Calculator
|
3
|
-
|
4
|
-
attr_reader :display
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
show 0
|
8
|
-
@operands = []
|
9
|
-
end
|
10
|
-
|
11
|
-
def enter value
|
12
|
-
show value
|
13
|
-
@operands.push value
|
14
|
-
end
|
15
|
-
|
16
|
-
def get_ready_to op
|
17
|
-
calculate_if_necessary
|
18
|
-
start_next_calculation
|
19
|
-
@operator = op
|
20
|
-
end
|
21
|
-
|
22
|
-
def equals
|
23
|
-
we_need_two_operands
|
24
|
-
deal_with_repeated_equals
|
25
|
-
unless @operator.nil?
|
26
|
-
show @operands.inject (@operator)
|
27
|
-
@last_operator = @operator
|
28
|
-
@operator = nil
|
29
|
-
@operands[0] = @display
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def show value
|
35
|
-
@display = value
|
36
|
-
end
|
37
|
-
|
38
|
-
def calculate_if_necessary
|
39
|
-
equals if @operands.size == 2
|
40
|
-
end
|
41
|
-
|
42
|
-
def start_next_calculation
|
43
|
-
@operands = [@display] if @operator.nil?
|
44
|
-
end
|
45
|
-
|
46
|
-
def we_need_two_operands
|
47
|
-
@operands.concat @operands if @operands.size == 1
|
48
|
-
end
|
49
|
-
|
50
|
-
def deal_with_repeated_equals
|
51
|
-
@operator = @last_operator if @operands.size == 2 && @operator.nil? && @last_operator
|
52
|
-
end
|
53
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
require 'erb'
|
3
|
-
$:.unshift(File.dirname(__FILE__), '.')
|
4
|
-
require 'calculator'
|
5
|
-
|
6
|
-
Sinatra::Base.enable :inline_templates
|
7
|
-
Sinatra::Base.enable :sessions
|
8
|
-
|
9
|
-
class WebCalculator < Sinatra::Base
|
10
|
-
|
11
|
-
helpers do
|
12
|
-
def operate_with
|
13
|
-
{ 'plus' => :+, 'minus' => :-}
|
14
|
-
end
|
15
|
-
|
16
|
-
def persist calc
|
17
|
-
session[:calc] = calc
|
18
|
-
end
|
19
|
-
|
20
|
-
def display_result_from calc
|
21
|
-
@display = calc.display
|
22
|
-
erb :index
|
23
|
-
end
|
24
|
-
|
25
|
-
def user_input
|
26
|
-
params[:number].to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
def selected_operator
|
30
|
-
params[:operator]
|
31
|
-
end
|
32
|
-
|
33
|
-
def display_result_from_session
|
34
|
-
@display = session[:calc].display ||= 0
|
35
|
-
erb :index
|
36
|
-
end
|
37
|
-
|
38
|
-
def input_entered?
|
39
|
-
not params[:number].empty?
|
40
|
-
end
|
41
|
-
|
42
|
-
def equals_pressed?
|
43
|
-
selected_operator == "equals"
|
44
|
-
end
|
45
|
-
|
46
|
-
def load_calculator
|
47
|
-
session[:calc] ||= Calculator.new
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
get '/' do
|
53
|
-
load_calculator
|
54
|
-
display_result_from_session
|
55
|
-
end
|
56
|
-
|
57
|
-
post '/' do
|
58
|
-
calculator = load_calculator
|
59
|
-
calculator.enter user_input if input_entered?
|
60
|
-
if equals_pressed?
|
61
|
-
calculator.equals
|
62
|
-
else
|
63
|
-
calculator.get_ready_to operate_with[selected_operator]
|
64
|
-
end
|
65
|
-
persist calculator
|
66
|
-
display_result_from calculator
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
__END__
|
71
|
-
@@ layout
|
72
|
-
<h1>Calculator is Ready!</h1>
|
73
|
-
<%= yield %>
|
74
|
-
|
75
|
-
@@ index
|
76
|
-
<form method="POST" action="/">
|
77
|
-
<input type="text" disabled name="display" id="display" value="<%=@display %>" />
|
78
|
-
<input type="text" name="number" id="number" />
|
79
|
-
<input type="submit" name="operator" id="minus" text="-" value="minus" />
|
80
|
-
<input type="submit" name="operator" id="plus" text="+" value="plus" />
|
81
|
-
<input type="submit" name="operator" id="equals" text="=" value="equals" />
|
82
|
-
</form>
|