coulda 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +5 -0
- data/VERSION +1 -1
- data/coulda.gemspec +8 -2
- data/example/feature_with_pending_scenario.rb +13 -0
- data/example/macros_in_a_module.rb +38 -0
- data/example/pending_feature.rb +5 -0
- data/example/pending_feature_with_purpose.rb +10 -0
- data/example/simple_reuse_via_method.rb +29 -0
- data/example/simple_scenario.rb +25 -0
- data/lib/coulda.rb +1 -0
- data/lib/coulda/tasks/print_features.rake +33 -0
- metadata +8 -2
- data/.gitignore +0 -4
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3
|
1
|
+
0.4.3
|
data/coulda.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{coulda}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Evan David Light"]
|
@@ -17,19 +17,25 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
".gitignore",
|
21
20
|
"HISTORY",
|
22
21
|
"LICENSE",
|
23
22
|
"README.rdoc",
|
24
23
|
"Rakefile",
|
25
24
|
"VERSION",
|
26
25
|
"coulda.gemspec",
|
26
|
+
"example/feature_with_pending_scenario.rb",
|
27
|
+
"example/macros_in_a_module.rb",
|
28
|
+
"example/pending_feature.rb",
|
29
|
+
"example/pending_feature_with_purpose.rb",
|
27
30
|
"example/sample.rb",
|
31
|
+
"example/simple_reuse_via_method.rb",
|
32
|
+
"example/simple_scenario.rb",
|
28
33
|
"geminstaller.yml",
|
29
34
|
"lib/coulda.rb",
|
30
35
|
"lib/coulda/feature.rb",
|
31
36
|
"lib/coulda/scenario.rb",
|
32
37
|
"lib/coulda/tasks.rb",
|
38
|
+
"lib/coulda/tasks/print_features.rake",
|
33
39
|
"lib/coulda/vendor/constantize.rb",
|
34
40
|
"lib/coulda/vendor/underscore.rb",
|
35
41
|
"test/feature_test.rb",
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'coulda'
|
3
|
+
include Coulda
|
4
|
+
|
5
|
+
module MyMacros
|
6
|
+
def given_something_without_a_value
|
7
|
+
Given "something without a value" do
|
8
|
+
@no_value = nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def assert_variable_has_a_value
|
13
|
+
assert(@no_value)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Feature "Painfully obvious" do
|
18
|
+
extend MyMacros
|
19
|
+
|
20
|
+
in_order_to "demonstrate a simple test"
|
21
|
+
as_a "coulda developer"
|
22
|
+
i_want_to "provide a straight-forward scenario"
|
23
|
+
|
24
|
+
|
25
|
+
Scenario "Describing something obvious" do
|
26
|
+
given_something_without_a_value
|
27
|
+
|
28
|
+
When "I give it a value" do
|
29
|
+
@no_value = true
|
30
|
+
end
|
31
|
+
|
32
|
+
Then "it should have a value" do
|
33
|
+
assert_variable_has_a_value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'coulda'
|
3
|
+
include Coulda
|
4
|
+
|
5
|
+
Feature "Painfully obvious" do
|
6
|
+
in_order_to "demonstrate a simple test"
|
7
|
+
as_a "coulda developer"
|
8
|
+
i_want_to "provide a straight-forward scenario"
|
9
|
+
|
10
|
+
def something_without_a_value
|
11
|
+
@no_value = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
Scenario "Describing something obvious" do
|
15
|
+
Given "something without a value" do
|
16
|
+
something_without_a_value
|
17
|
+
end
|
18
|
+
|
19
|
+
When "I give it a value" do
|
20
|
+
@no_value = true
|
21
|
+
end
|
22
|
+
|
23
|
+
Then "it should have a value" do
|
24
|
+
assert(@no_value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'coulda'
|
3
|
+
include Coulda
|
4
|
+
|
5
|
+
Feature "Painfully obvious" do
|
6
|
+
in_order_to "demonstrate a simple test"
|
7
|
+
as_a "coulda developer"
|
8
|
+
i_want_to "provide a straight-forward scenario"
|
9
|
+
|
10
|
+
Scenario "Describing something obvious" do
|
11
|
+
Given "something without a value" do
|
12
|
+
@no_value = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
When "I give it a value" do
|
16
|
+
@no_value = true
|
17
|
+
end
|
18
|
+
|
19
|
+
Then "it should have a value" do
|
20
|
+
assert(@no_value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
data/lib/coulda.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
namespace :coulda do
|
2
|
+
desc "Print all features as plain text"
|
3
|
+
task :print_features do
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift("test")
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
# bug in test unit. Set to true to stop from running.
|
10
|
+
Test::Unit.run = true
|
11
|
+
|
12
|
+
test_files = Dir.glob(File.join('test', '**', '*_feature.rb'))
|
13
|
+
test_files.each do |file|
|
14
|
+
load file
|
15
|
+
end
|
16
|
+
|
17
|
+
ObjectSpace.each_object do |obj|
|
18
|
+
next unless obj.is_a? Feature
|
19
|
+
|
20
|
+
puts "Feature: #{obj.name}"
|
21
|
+
puts " In order to #{obj.in_order_to}" if obj.in_order_to
|
22
|
+
puts " As a #{obj.as_a}" if obj.as_a
|
23
|
+
puts " I want to #{obj.i_want_to}" if obj.i_want_to
|
24
|
+
obj.scenarios.each do |scenario|
|
25
|
+
puts
|
26
|
+
puts " Scenario: #{scenario.name} #{scenario.pending? ? '(pending)' : ''}"
|
27
|
+
scenario.statements.each do |stmt|
|
28
|
+
puts " #{stmt[:type].to_s} #{stmt[:text]}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan David Light
|
@@ -32,19 +32,25 @@ extra_rdoc_files:
|
|
32
32
|
- LICENSE
|
33
33
|
- README.rdoc
|
34
34
|
files:
|
35
|
-
- .gitignore
|
36
35
|
- HISTORY
|
37
36
|
- LICENSE
|
38
37
|
- README.rdoc
|
39
38
|
- Rakefile
|
40
39
|
- VERSION
|
41
40
|
- coulda.gemspec
|
41
|
+
- example/feature_with_pending_scenario.rb
|
42
|
+
- example/macros_in_a_module.rb
|
43
|
+
- example/pending_feature.rb
|
44
|
+
- example/pending_feature_with_purpose.rb
|
42
45
|
- example/sample.rb
|
46
|
+
- example/simple_reuse_via_method.rb
|
47
|
+
- example/simple_scenario.rb
|
43
48
|
- geminstaller.yml
|
44
49
|
- lib/coulda.rb
|
45
50
|
- lib/coulda/feature.rb
|
46
51
|
- lib/coulda/scenario.rb
|
47
52
|
- lib/coulda/tasks.rb
|
53
|
+
- lib/coulda/tasks/print_features.rake
|
48
54
|
- lib/coulda/vendor/constantize.rb
|
49
55
|
- lib/coulda/vendor/underscore.rb
|
50
56
|
- test/feature_test.rb
|
data/.gitignore
DELETED