Skip to content

Commit

Permalink
Created Slovak example for addition and division feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Al Hafoudh authored and Ahmed Al Hafoudh committed Mar 30, 2009
1 parent a2095f2 commit 1b92430
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/i18n/sk/.gitignore
@@ -0,0 +1 @@
features.html
6 changes: 6 additions & 0 deletions examples/i18n/sk/Rakefile
@@ -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
16 changes: 16 additions & 0 deletions examples/i18n/sk/features/addition.feature
@@ -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 |
9 changes: 9 additions & 0 deletions examples/i18n/sk/features/division.feature
@@ -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 examples/i18n/sk/features/step_definitons/calculator_steps.rb
@@ -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
14 changes: 14 additions & 0 deletions examples/i18n/sk/lib/calculator.rb
@@ -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

0 comments on commit 1b92430

Please sign in to comment.