aslakhellesoy-cucumber 0.1.14.1 → 0.1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language ko"
6
+ end
@@ -0,0 +1,17 @@
1
+ 기능: 덧셈
2
+ 어이없는 실수을 방지하기 위해
3
+ 수학을 잘 못하는 사람으로써
4
+ 두숫자의 합을 알고 싶다
5
+
6
+ 예: 두 숫자를 더하기
7
+ 조건 계산기에 50을 입력했음
8
+ 그리고 계산기에 70을 입력했음
9
+ 만일 내가 add를 누루면
10
+ 그러면 화면에 출력된 결과는 120이다
11
+ 그리고 결과의 class는 Fixnum이다
12
+
13
+ 다른 예:
14
+ | 입력1 | 입력2 | 버튼 | 결과 | class |
15
+ | 20 | 30 | add | 50 | Fixnum |
16
+ | 2 | 5 | add | 7 | Fixnum |
17
+ | 0 | 40 | add | 40 | Fixnum |
@@ -0,0 +1,11 @@
1
+ 기능: 나눗셈
2
+ 어이없는 실수을 방지하기 위해
3
+ 분수를 계산 능력 요구한다
4
+
5
+ 예: 보통 숫자
6
+ 조건 계산기에 3을 입력했음
7
+ 그리고 계산기에 2을 입력했음
8
+ 만일 내가 divide를 누루면
9
+ 그러면 화면에 출력된 결과는 1.5이다
10
+ 그리고 결과의 class는 Float이다
11
+
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatters/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Given /^계산기에 (.*)을 입력했음$/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ When /^내가 (.*)를 누루면$/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Then /^화면에 출력된 결과는 (.*)이다$/ do |result|
23
+ @result.should == result.to_f
24
+ end
25
+
26
+ Then /^결과의 class는 (.*)이다$/ do |class_name|
27
+ @result.class.name.should == class_name
28
+ end
@@ -0,0 +1,14 @@
1
+ class Calculator
2
+ def push(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def add
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def divide
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end