cucumber-pride 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/Rakefile +5 -0
- data/cucumber-pride.gemspec +1 -0
- data/features/addition.feature +17 -0
- data/features/division.feature +10 -0
- data/features/step_definitions/calculator_steps.rb +38 -0
- data/lib/cucumber-pride/version.rb +1 -1
- metadata +25 -3
data/README.md
CHANGED
@@ -26,6 +26,10 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
$ gem install cucumber-pride
|
28
28
|
|
29
|
+
## Tests
|
30
|
+
|
31
|
+
The tests are a lie! They don't test cucumber-pride directly, they just produce enough output so that you can visually verify that everything is working. This was much faster than writing actual tests and works just as well in this case.
|
32
|
+
|
29
33
|
## Usage
|
30
34
|
|
31
35
|
TODO: Write usage instructions here
|
data/Rakefile
CHANGED
data/cucumber-pride.gemspec
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# language: en
|
2
|
+
Feature: Addition
|
3
|
+
In order to avoid silly mistakes
|
4
|
+
As a math idiot
|
5
|
+
I want to be told the sum of two numbers
|
6
|
+
|
7
|
+
Scenario Outline: Add two numbers
|
8
|
+
Given I have entered <input_1> into the calculator
|
9
|
+
And I have entered <input_2> into the calculator
|
10
|
+
When I press <button>
|
11
|
+
Then the result should be <output> on the screen
|
12
|
+
|
13
|
+
Examples:
|
14
|
+
| input_1 | input_2 | button | output |
|
15
|
+
| 20 | 30 | add | 50 |
|
16
|
+
| 2 | 5 | add | 7 |
|
17
|
+
| 0 | 40 | add | 40 |
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# language: en
|
2
|
+
Feature: Division
|
3
|
+
In order to avoid silly mistakes
|
4
|
+
Cashiers must be able to calculate a fraction
|
5
|
+
|
6
|
+
Scenario: Regular numbers
|
7
|
+
* I have entered 3 into the calculator
|
8
|
+
* I have entered 2 into the calculator
|
9
|
+
* I press divide
|
10
|
+
* the result should be 1.5 on the screen
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
|
3
|
+
require 'cucumber/formatter/unicode'
|
4
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
5
|
+
|
6
|
+
class Calculator
|
7
|
+
def push(n)
|
8
|
+
@args ||= []
|
9
|
+
@args << n
|
10
|
+
end
|
11
|
+
|
12
|
+
def add
|
13
|
+
@args.inject(0){|n,sum| sum+=n}
|
14
|
+
end
|
15
|
+
|
16
|
+
def divide
|
17
|
+
@args[0].to_f / @args[1].to_f
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Before do
|
22
|
+
@calc = Calculator.new
|
23
|
+
end
|
24
|
+
|
25
|
+
After do
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /I have entered (\d+) into the calculator/ do |n|
|
29
|
+
@calc.push n.to_i
|
30
|
+
end
|
31
|
+
|
32
|
+
When /I press (\w+)/ do |op|
|
33
|
+
@result = @calc.send op
|
34
|
+
end
|
35
|
+
|
36
|
+
Then /the result should be (.*) on the screen/ do |result|
|
37
|
+
@result.should == result.to_f
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-pride
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.1.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.9.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.9.0
|
30
46
|
description: Mimics the functionality of minitest/pride for Cucumber
|
31
47
|
email:
|
32
48
|
- pvandenberk@mac.com
|
@@ -40,6 +56,9 @@ files:
|
|
40
56
|
- README.md
|
41
57
|
- Rakefile
|
42
58
|
- cucumber-pride.gemspec
|
59
|
+
- features/addition.feature
|
60
|
+
- features/division.feature
|
61
|
+
- features/step_definitions/calculator_steps.rb
|
43
62
|
- lib/cucumber-pride.rb
|
44
63
|
- lib/cucumber-pride/version.rb
|
45
64
|
homepage: https://github.com/pvdb/cucumber-pride
|
@@ -66,4 +85,7 @@ rubygems_version: 1.8.21
|
|
66
85
|
signing_key:
|
67
86
|
specification_version: 3
|
68
87
|
summary: Take pride in your testing
|
69
|
-
test_files:
|
88
|
+
test_files:
|
89
|
+
- features/addition.feature
|
90
|
+
- features/division.feature
|
91
|
+
- features/step_definitions/calculator_steps.rb
|