forked from cucumber/cucumber-ruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Slovak example for addition and division feature
- Loading branch information
Ahmed Al Hafoudh
authored and
Ahmed Al Hafoudh
committed
Mar 30, 2009
1 parent
a2095f2
commit 1b92430
Showing
6 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
features.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
$:.unshift(File.dirname(__FILE__) + '/../../../lib') | |||
require 'cucumber/rake/task' | |||
|
|||
Cucumber::Rake::Task.new do |t| | |||
t.cucumber_opts = "--language sk" | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
Požiadavka: Sčítavanie | |||
Aby som sa vyhol hlúpim chybám | |||
Ako matematický idiot | |||
Chcem vedieť ako sa sčítavajú dve čísla | |||
|
|||
Náčrt Scenáru: Sčítanie dvoch čísel | |||
Pokiaľ Zadám číslo <vstup_1> do kalkulačky | |||
A Zadám číslo <vstup_2> do kalkulačky | |||
Keď Stlačím tlačidlo <tlačidlo> | |||
Tak Výsledok by mal byť <výstup> | |||
|
|||
Príklady: | |||
| vstup_1 | vstup_2 | tlačidlo | výstup | | |||
| 20 | 30 | add | 50 | | |||
| 2 | 5 | add | 7 | | |||
| 0 | 40 | add | 40 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
Požiadavka: Delenie | |||
Aby som sa vyhol hlúpim chybám | |||
Pokladníci musia vedieť vypočítať podiel | |||
|
|||
Scenár: Prirodzené čísla | |||
Pokiaľ Zadám číslo 3 do kalkulačky | |||
A Zadám číslo 2 do kalkulačky | |||
Keď Stlačím tlačidlo divide | |||
Tak Výsledok by mal byť 1.5 |
24 changes: 24 additions & 0 deletions
24
examples/i18n/sk/features/step_definitons/calculator_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
# encoding: utf-8 | |||
require 'spec/expectations' | |||
$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |||
require 'cucumber/formatter/unicode' | |||
require 'calculator' | |||
|
|||
Before do | |||
@calc = Calculator.new | |||
end | |||
|
|||
After do | |||
end | |||
|
|||
Given /Zadám číslo (\d+) do kalkulačky/ do |n| | |||
@calc.push n.to_i | |||
end | |||
|
|||
When /Stlačím tlačidlo (\w+)/ do |op| | |||
@result = @calc.send op | |||
end | |||
|
|||
Then /Výsledok by mal byť (.*)/ do |result| | |||
@result.should == result.to_f | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
class Calculator | |||
def push(n) | |||
@args ||= [] | |||
@args << n | |||
end | |||
|
|||
def add | |||
@args.inject(0){|n,sum| sum+=n} | |||
end | |||
|
|||
def divide | |||
@args[0].to_f / @args[1].to_f | |||
end | |||
end |