aslakhellesoy-cucumber 0.1.5 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +228 -0
- data/License.txt +20 -0
- data/Manifest.txt +226 -0
- data/README.txt +41 -0
- data/Rakefile +9 -0
- data/TODO.txt +26 -0
- data/bin/cucumber +5 -0
- data/config/hoe.rb +69 -0
- data/config/requirements.rb +15 -0
- data/cucumber.yml +1 -0
- data/examples/calculator_ruby_features/Rakefile +6 -0
- data/examples/calculator_ruby_features/features/addition.rb +23 -0
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +43 -0
- data/examples/cs/README.textile +22 -0
- data/examples/cs/Rakefile +12 -0
- data/examples/cs/features/hello.feature +11 -0
- data/examples/cs/features/step_definitons/hello_steps.rb +25 -0
- data/examples/cs/features/step_definitons/tree_steps.rb +14 -0
- data/examples/cs/features/tree.feature +9 -0
- data/examples/cs/src/Hello.cs +18 -0
- data/examples/dos_line_endings/Rakefile +6 -0
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
- data/examples/i18n/README.textile +18 -0
- data/examples/i18n/Rakefile +16 -0
- data/examples/i18n/ar/Rakefile +6 -0
- data/examples/i18n/ar/features/addition.feature +17 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/ar/lib/calculator.rb +10 -0
- data/examples/i18n/da/Rakefile +6 -0
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/da/features/summering.feature +17 -0
- data/examples/i18n/da/lib/kalkulator.rb +11 -0
- data/examples/i18n/en/Rakefile +5 -0
- data/examples/i18n/en/features/addition.feature +17 -0
- data/examples/i18n/en/features/division.feature +10 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/en/lib/calculator.rb +14 -0
- data/examples/i18n/es/Rakefile +6 -0
- data/examples/i18n/es/features/adicion.feature +17 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +22 -0
- data/examples/i18n/es/lib/calculador.rb +11 -0
- data/examples/i18n/et/Rakefile +6 -0
- data/examples/i18n/et/features/liitmine.feature +17 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +26 -0
- data/examples/i18n/et/lib/kalkulaator.rb +10 -0
- data/examples/i18n/fr/Rakefile +6 -0
- data/examples/i18n/fr/features/addition.feature +13 -0
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +22 -0
- data/examples/i18n/fr/lib/calculatrice.rb +10 -0
- data/examples/i18n/id/Rakefile +6 -0
- data/examples/i18n/id/features/addition.feature +17 -0
- data/examples/i18n/id/features/division.feature +10 -0
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/id/lib/calculator.rb +14 -0
- data/examples/i18n/it/Rakefile +6 -0
- data/examples/i18n/it/features/somma.feature +10 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +22 -0
- data/examples/i18n/it/lib/calcolatrice.rb +11 -0
- data/examples/i18n/ja/README.txt +5 -0
- data/examples/i18n/ja/Rakefile +6 -0
- data/examples/i18n/ja/features/addition.feature +17 -0
- data/examples/i18n/ja/features/division.feature +10 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +30 -0
- data/examples/i18n/ja/lib/calculator.rb +14 -0
- data/examples/i18n/no/Rakefile +6 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/no/features/summering.feature +17 -0
- data/examples/i18n/no/lib/kalkulator.rb +11 -0
- data/examples/i18n/pt/Rakefile +6 -0
- data/examples/i18n/pt/features/adicao.feature +10 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +22 -0
- data/examples/i18n/pt/lib/calculadora.rb +10 -0
- data/examples/i18n/ro/Rakefile +6 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +22 -0
- data/examples/i18n/ro/features/suma.feature +10 -0
- data/examples/i18n/ro/lib/calculator.rb +11 -0
- data/examples/i18n/se/Rakefile +6 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/se/features/summering.feature +17 -0
- data/examples/i18n/se/lib/kalkulator.rb +11 -0
- data/examples/i18n/zh-CN/Rakefile +6 -0
- data/examples/i18n/zh-CN/features/addition.feature +17 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
- data/examples/java/README.textile +22 -0
- data/examples/java/Rakefile +12 -0
- data/examples/java/features/hello.feature +11 -0
- data/examples/java/features/step_definitons/hello_steps.rb +25 -0
- data/examples/java/features/step_definitons/tree_steps.rb +14 -0
- data/examples/java/features/tree.feature +9 -0
- data/examples/java/src/cucumber/demo/Hello.java +16 -0
- data/examples/selenium/Rakefile +6 -0
- data/examples/selenium/features/search.feature +9 -0
- data/examples/selenium/features/step_definitons/stories_steps.rb +41 -0
- data/examples/tickets/Rakefile +11 -0
- data/examples/tickets/cucumber.yml +2 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +32 -0
- data/examples/tickets/features/tickets.feature +22 -0
- data/examples/watir/Rakefile +6 -0
- data/examples/watir/features/search.feature +9 -0
- data/examples/watir/features/step_definitons/stories_steps.rb +51 -0
- data/features/see_features.feature +8 -0
- data/features/steps/features_steps.rb +9 -0
- data/gem_tasks/deployment.rake +34 -0
- data/gem_tasks/environment.rake +7 -0
- data/gem_tasks/features.rake +6 -0
- data/gem_tasks/fix_cr_lf.rake +10 -0
- data/gem_tasks/flog.rake +4 -0
- data/gem_tasks/gemspec.rake +6 -0
- data/gem_tasks/rspec.rake +21 -0
- data/gem_tasks/treetop.rake +41 -0
- data/lib/autotest/cucumber.rb +6 -0
- data/lib/autotest/cucumber_mixin.rb +109 -0
- data/lib/autotest/cucumber_rails.rb +6 -0
- data/lib/autotest/cucumber_rails_rspec.rb +6 -0
- data/lib/autotest/cucumber_rspec.rb +6 -0
- data/lib/autotest/discover.rb +9 -0
- data/lib/cucumber.rb +39 -0
- data/lib/cucumber/broadcaster.rb +20 -0
- data/lib/cucumber/cli.rb +269 -0
- data/lib/cucumber/core_ext/proc.rb +54 -0
- data/lib/cucumber/core_ext/string.rb +22 -0
- data/lib/cucumber/executor.rb +170 -0
- data/lib/cucumber/formatters.rb +1 -0
- data/lib/cucumber/formatters/ansicolor.rb +111 -0
- data/lib/cucumber/formatters/autotest_formatter.rb +23 -0
- data/lib/cucumber/formatters/cucumber.css +132 -0
- data/lib/cucumber/formatters/cucumber.js +11 -0
- data/lib/cucumber/formatters/html_formatter.rb +128 -0
- data/lib/cucumber/formatters/jquery.js +32 -0
- data/lib/cucumber/formatters/pretty_formatter.rb +234 -0
- data/lib/cucumber/formatters/profile_formatter.rb +92 -0
- data/lib/cucumber/formatters/progress_formatter.rb +58 -0
- data/lib/cucumber/languages.yml +235 -0
- data/lib/cucumber/model.rb +1 -0
- data/lib/cucumber/model/table.rb +28 -0
- data/lib/cucumber/rails/rspec.rb +12 -0
- data/lib/cucumber/rails/world.rb +73 -0
- data/lib/cucumber/rake/task.rb +101 -0
- data/lib/cucumber/step_methods.rb +49 -0
- data/lib/cucumber/step_mother.rb +89 -0
- data/lib/cucumber/tree.rb +18 -0
- data/lib/cucumber/tree/feature.rb +61 -0
- data/lib/cucumber/tree/features.rb +21 -0
- data/lib/cucumber/tree/given_scenario.rb +13 -0
- data/lib/cucumber/tree/scenario.rb +158 -0
- data/lib/cucumber/tree/step.rb +134 -0
- data/lib/cucumber/tree/table.rb +26 -0
- data/lib/cucumber/tree/top_down_visitor.rb +23 -0
- data/lib/cucumber/treetop_parser/feature.treetop.erb +206 -0
- data/lib/cucumber/treetop_parser/feature_ar.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_cy.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_da.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_de.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_en.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_es.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_et.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_fr.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_id.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_it.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ja.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_nl.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_no.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_parser.rb +34 -0
- data/lib/cucumber/treetop_parser/feature_pl.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_pt.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ro.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ro2.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ru.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_se.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1591 -0
- data/lib/cucumber/version.rb +9 -0
- data/rails_generators/cucumber/USAGE +11 -0
- data/rails_generators/cucumber/cucumber_generator.rb +30 -0
- data/rails_generators/cucumber/templates/cucumber +7 -0
- data/rails_generators/cucumber/templates/cucumber.rake +7 -0
- data/rails_generators/cucumber/templates/env.rb +8 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +46 -0
- data/rails_generators/feature/USAGE +12 -0
- data/rails_generators/feature/feature_generator.rb +16 -0
- data/rails_generators/feature/templates/feature.erb +28 -0
- data/rails_generators/feature/templates/steps.erb +22 -0
- data/script/console +10 -0
- data/script/console.cmd +1 -0
- data/script/destroy +14 -0
- data/script/destroy.cmd +1 -0
- data/script/generate +14 -0
- data/script/generate.cmd +1 -0
- data/script/txt2html +74 -0
- data/script/txt2html.cmd +1 -0
- data/setup.rb +1585 -0
- data/spec/cucumber/broadcaster_spec.rb +27 -0
- data/spec/cucumber/cli_spec.rb +242 -0
- data/spec/cucumber/core_ext/proc_spec.rb +45 -0
- data/spec/cucumber/core_ext/string_spec.rb +34 -0
- data/spec/cucumber/executor_spec.rb +222 -0
- data/spec/cucumber/formatters/ansicolor_spec.rb +35 -0
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +26 -0
- data/spec/cucumber/formatters/features.html +269 -0
- data/spec/cucumber/formatters/html_formatter_spec.rb +74 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +204 -0
- data/spec/cucumber/formatters/profile_formatter_spec.rb +192 -0
- data/spec/cucumber/formatters/progress_formatter_spec.rb +65 -0
- data/spec/cucumber/model/table_spec.rb +20 -0
- data/spec/cucumber/rails/stubs/mini_rails.rb +17 -0
- data/spec/cucumber/rails/stubs/test_help.rb +1 -0
- data/spec/cucumber/rails/world_spec.rb +11 -0
- data/spec/cucumber/sell_cucumbers.feature +19 -0
- data/spec/cucumber/step_mother_spec.rb +74 -0
- data/spec/cucumber/tree/feature_spec.rb +12 -0
- data/spec/cucumber/tree/row_scenario_spec.rb +25 -0
- data/spec/cucumber/tree/scenario_spec.rb +76 -0
- data/spec/cucumber/tree/step_spec.rb +50 -0
- data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
- data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +98 -0
- data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
- data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
- data/spec/cucumber/treetop_parser/multiple_tables.feature +29 -0
- data/spec/cucumber/treetop_parser/spaces.feature +10 -0
- data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
- data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +19 -0
- metadata +151 -35
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given "كتابة $n في الآلة الحاسبة" do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /يتم الضغط على (\w+)/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /يظهر (.*) على الشاشة/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /يجب ان يكون (\w*)/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /it should rain on (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'kalkulator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Kalkulator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /at jeg har indtastet (\d+)/ do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When 'jeg summerer' do
|
17
|
+
@result = @calc.add
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /skal resultatet være (\d*)/ do |result|
|
21
|
+
@result.should == result.to_i
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Egenskab: Summering
|
2
|
+
For at slippe for at lave dumme fejl
|
3
|
+
Som en regnskabsfører
|
4
|
+
Vil jeg kunne lægge sammen
|
5
|
+
|
6
|
+
Scenarie: to tal
|
7
|
+
Givet at jeg har indtastet 5
|
8
|
+
Og at jeg har indtastet 7
|
9
|
+
Når jeg summerer
|
10
|
+
Så skal resultatet være 12
|
11
|
+
|
12
|
+
Scenarie: tre tal
|
13
|
+
Givet at jeg har indtastet 5
|
14
|
+
Og at jeg har indtastet 7
|
15
|
+
Og at jeg har indtastet 1
|
16
|
+
Når jeg summerer
|
17
|
+
Så skal resultatet være 13
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Addition
|
2
|
+
In order to avoid silly mistakes
|
3
|
+
As a math idiot
|
4
|
+
I want to be told the sum of two numbers
|
5
|
+
|
6
|
+
Scenario: Add two numbers
|
7
|
+
Given I have entered 50 into the calculator
|
8
|
+
And I have entered 70 into the calculator
|
9
|
+
When I press add
|
10
|
+
Then the result should be 120 on the screen
|
11
|
+
And the result class should be Fixnum
|
12
|
+
|
13
|
+
More Examples:
|
14
|
+
| input_1 | input_2 | button | output | class |
|
15
|
+
| 20 | 30 | add | 50 | Fixnum |
|
16
|
+
| 2 | 5 | add | 7 | Fixnum |
|
17
|
+
| 0 | 40 | add | 40 | Fixnum |
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Division
|
2
|
+
In order to avoid silly mistakes
|
3
|
+
Cashiers must be able to calculate a fraction
|
4
|
+
|
5
|
+
Scenario: Regular numbers
|
6
|
+
Given I have entered 3 into the calculator
|
7
|
+
And I have entered 2 into the calculator
|
8
|
+
When I press divide
|
9
|
+
Then the result should be 1.5 on the screen
|
10
|
+
And the result class should be Float
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given "I have entered $n into the calculator" do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /I press (\w+)/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /the result should be (.*) on the screen/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /the result class should be (\w*)/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /it should rain on (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Característica: adición
|
2
|
+
Para evitar hacer errores tontos
|
3
|
+
Como contador
|
4
|
+
Quiero saber la suma de los números
|
5
|
+
|
6
|
+
Escenario: dos números
|
7
|
+
Dado que he introducido 5
|
8
|
+
Y he introducido 7
|
9
|
+
Cuando añado
|
10
|
+
Entonces el resultado debe ser 12
|
11
|
+
|
12
|
+
Escenario: tres números
|
13
|
+
Dado que he introducido 5
|
14
|
+
Y he introducido 7
|
15
|
+
Y he introducido 1
|
16
|
+
Cuando añado
|
17
|
+
Entonces el resultado debe ser 13
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculador'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculador.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /he introducido (\d+)/ do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When 'añado' do
|
17
|
+
@result = @calc.add
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /el resultado debe ser (\d*)/ do |result|
|
21
|
+
@result.should == result.to_i
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Omadus: Liitmine
|
2
|
+
Selleks et vältida rumalaid vigu
|
3
|
+
Olles matemaatika-puupea
|
4
|
+
Tahan et mulle öeldaks kahe numbri summa
|
5
|
+
|
6
|
+
Stsenaarium: Liida kaks numbrit
|
7
|
+
Eeldades et olen sisestanud kalkulaatorisse numbri 50
|
8
|
+
Ja olen sisestanud kalkulaatorisse numbri 70
|
9
|
+
Kui ma vajutan liida
|
10
|
+
Siis vastuseks peab ekraanil kuvatama 120
|
11
|
+
Ja vastuseklass peab olema tüüpi Fixnum
|
12
|
+
|
13
|
+
More Examples:
|
14
|
+
| input_1 | input_2 | button | output | class |
|
15
|
+
| 20 | 30 | liida | 50 | Fixnum |
|
16
|
+
| 2 | 5 | liida | 7 | Fixnum |
|
17
|
+
| 0 | 40 | liida | 40 | Fixnum |
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'kalkulaator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Kalkulaator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /olen sisestanud kalkulaatorisse numbri (\d+)/ do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /ma vajutan (.*)/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /vastuseks peab ekraanil kuvatama (\d*)/ do |result|
|
21
|
+
@result.should == result.to_i
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /vastuseklass peab olema tüüpi (\w*)/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Fonction: Addition
|
2
|
+
Afin d'eviter des conneries
|
3
|
+
Etant un comptable
|
4
|
+
Je désire additionner deux chiffres
|
5
|
+
|
6
|
+
Scenario: 7 et 5
|
7
|
+
Soit que j'ai entré 5
|
8
|
+
Et que j'ai entré 7
|
9
|
+
|
10
|
+
Scenario: Additionner
|
11
|
+
SoitScenario: 7 et 5
|
12
|
+
Lorsque je tape additionner
|
13
|
+
Alors le reultat doit être 12
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculatrice'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calulatrice.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /que j'ai entré (\d+)/ do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When 'je tape additionner' do
|
17
|
+
@result = @calc.additionner
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /le reultat doit être (\d*)/ do |result|
|
21
|
+
@result.should == result.to_i
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Fitur: Addition
|
2
|
+
Untuk menghindari kesalahan konyol
|
3
|
+
Sebagai orang yang gak bisa matematika
|
4
|
+
Aku ingin diberi tahu jumlah dua bilangan
|
5
|
+
|
6
|
+
Skenario: Menjumlahkan dua bilangan
|
7
|
+
Dengan aku sudah masukkan 50 ke kalkulator
|
8
|
+
Dan aku sudah masukkan 70 ke kalkulator
|
9
|
+
Ketika aku tekan add
|
10
|
+
Maka hasilnya harus 120 di layar
|
11
|
+
Dan class hasilnya harus Fixnum
|
12
|
+
|
13
|
+
Contoh Tambahan:
|
14
|
+
| input_1 | input_2 | button | output | class |
|
15
|
+
| 20 | 30 | add | 50 | Fixnum |
|
16
|
+
| 2 | 5 | add | 7 | Fixnum |
|
17
|
+
| 0 | 40 | add | 40 | Fixnum |
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Fitur: Division
|
2
|
+
Untuk hindari kesalahan konyol
|
3
|
+
Kasir harus dapat menghitung pembagian
|
4
|
+
|
5
|
+
Skenario: bilangan biasa
|
6
|
+
Dengan aku sudah masukkan 3 ke kalkulator
|
7
|
+
Dan aku sudah masukkan 2 ke kalkulator
|
8
|
+
Ketika aku tekan divide
|
9
|
+
Maka hasilnya harus 1.5 di layar
|
10
|
+
Dan class hasilnya harus Float
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given "aku sudah masukkan $n ke kalkulator" do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /aku tekan (\w+)/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /hasilnya harus (.*) di layar/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /class hasilnya harus (\w*)/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /it should rain on (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
31
|
+
|