Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
72 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 | 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 | 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 = %w{--format pretty} | ||
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# language: el | ||
Δυνατότητα: Πρόσθεση | ||
Για να αποφεύγω χαζά λάθη | ||
Ως πρωτάρης στα μαθηματικά | ||
Θέλω να βλέπω το άθροισμα δύο αριθμών | ||
|
||
Περιγραφή Σεναρίου: Πρόσθεση δύο αριθμών | ||
Δεδομένου ότι έχω εισάγει <τελεστής_1> στην αριθμομηχανή | ||
Και έχω εισάγει <τελεστής_2> στην αριθμομηχανή | ||
Όταν πατάω <κουμπί> | ||
Τότε το αποτέλεσμα στην οθόνη πρέπει να είναι <αποτέλεσμα> | ||
|
||
Παραδείγματα: | ||
| τελεστής_1 | τελεστής_2 | κουμπί | αποτέλεσμα | | ||
| 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# language: el | ||
Δυνατότητα: Διαίρεση | ||
Για να αποφευχθούν χαζά λάθη | ||
Οι ταμίες θα πρέπει να μπορούν να υπολογίζουν κλάσματα | ||
|
||
Σενάριο: Κανονικοί αριθμοί | ||
Δεδομένου ότι έχω εισάγει 3 στην αριθμομηχανή | ||
Και έχω εισάγει 2 στην αριθμομηχανή | ||
Όταν πατάω divide | ||
Τότε το αποτέλεσμα στην οθόνη πρέπει να είναι 1.5 |
24 changes: 24 additions & 0 deletions
24
examples/i18n/el/features/step_definitions/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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# encoding: utf-8 | ||
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end | ||
require 'cucumber/formatter/unicode' | ||
$:.unshift(File.dirname(__FILE__) + '/../../lib') | ||
require 'calculator' | ||
|
||
Before do | ||
@calc = Calculator.new | ||
end | ||
|
||
After do | ||
end | ||
|
||
Δεδομένου ότι /έχω εισάγει (\d+) στην αριθμομηχανή/ do |n| | ||
@calc.push n.to_i | ||
end | ||
|
||
Όταν /πατάω (\w+)/ do |op| | ||
@result = @calc.send op | ||
end | ||
|
||
Τότε /το αποτέλεσμα στην οθόνη πρέπει να είναι (.*)/ 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 | 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 |