elight-coulda 0.1.1 → 0.1.4
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.
- data/HISTORY +4 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/coulda.gemspec +1 -1
- data/lib/coulda/feature.rb +4 -4
- data/lib/coulda/scenario.rb +1 -11
- data/lib/coulda.rb +3 -0
- data/test/feature_test.rb +12 -5
- metadata +2 -3
data/HISTORY
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/coulda.gemspec
CHANGED
data/lib/coulda/feature.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
1
|
module Coulda
|
4
2
|
class Feature < Test::Unit::TestCase
|
5
3
|
class << self
|
@@ -52,8 +50,10 @@ module Coulda
|
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
55
|
-
#
|
56
|
-
def default_test
|
53
|
+
# Scenario-less features should be pending
|
54
|
+
def default_test
|
55
|
+
pending
|
56
|
+
end
|
57
57
|
end
|
58
58
|
|
59
59
|
%w[Given When Then].each do |statement|
|
data/lib/coulda/scenario.rb
CHANGED
@@ -10,19 +10,12 @@ module Coulda
|
|
10
10
|
@statements = []
|
11
11
|
check_statements
|
12
12
|
@pending = @statements.empty? || @statements.any? { |s| s.block.nil? }
|
13
|
-
@last_stmt_type = nil
|
14
13
|
end
|
15
14
|
|
16
15
|
%w[Given When Then].each do |statement|
|
17
16
|
eval <<-HERE
|
18
17
|
def #{statement}(name, &block)
|
19
|
-
|
20
|
-
@statements << stmt = Statement.new(:#{statement}, name, block)
|
21
|
-
elsif pending?
|
22
|
-
# TODO
|
23
|
-
elseif
|
24
|
-
block.call
|
25
|
-
end
|
18
|
+
@statements << stmt = Statement.new(:#{statement}, name, block)
|
26
19
|
end
|
27
20
|
HERE
|
28
21
|
end
|
@@ -34,13 +27,10 @@ module Coulda
|
|
34
27
|
private
|
35
28
|
|
36
29
|
def check_statements
|
37
|
-
@validating_semantics = true
|
38
30
|
if @block
|
39
31
|
instance_eval &@block
|
40
32
|
assert_statements
|
41
33
|
end
|
42
|
-
@validating_semantics = false
|
43
|
-
|
44
34
|
end
|
45
35
|
|
46
36
|
def assert_statements
|
data/lib/coulda.rb
CHANGED
data/test/feature_test.rb
CHANGED
@@ -2,9 +2,14 @@ require File.join(File.dirname(__FILE__), "test_helper")
|
|
2
2
|
|
3
3
|
class FeatureTest < Test::Unit::TestCase
|
4
4
|
def run_feature(feature)
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
if Object::RUBY_VERSION =~ /^1.9/
|
6
|
+
result = MiniTest::Unit.autorun
|
7
|
+
else
|
8
|
+
# Assume 1.8.x
|
9
|
+
result = Test::Unit::TestResult.new
|
10
|
+
p = Proc.new {}
|
11
|
+
feature.suite.run(result, &p)
|
12
|
+
end
|
8
13
|
result
|
9
14
|
end
|
10
15
|
|
@@ -80,7 +85,7 @@ class FeatureTest < Test::Unit::TestCase
|
|
80
85
|
|
81
86
|
should "not have any errors when run" do
|
82
87
|
result = run_feature @feature_without_scenarios
|
83
|
-
assert(result.
|
88
|
+
Object::RUBY_VERSION =~ /^1.9/ ? assert(result.inspect) : assert(result)
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
@@ -100,7 +105,9 @@ class FeatureTest < Test::Unit::TestCase
|
|
100
105
|
context "with a block containing a scenario" do
|
101
106
|
should "create a Feature instance method named 'test_<underscored_scenario_name>'" do
|
102
107
|
@feature_without_errors.Scenario "pending scenario"
|
103
|
-
|
108
|
+
test_name = "test_pending_scenario"
|
109
|
+
test_name = :test_pending_scenario if RUBY_VERSION =~ /^1.9/
|
110
|
+
assert(@feature_without_errors.instance_methods.include?(test_name), "Feature is missing test method from scenario")
|
104
111
|
end
|
105
112
|
|
106
113
|
should "create a Scenario" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elight-coulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan David Light
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- test/test_helper.rb
|
49
49
|
has_rdoc: false
|
50
50
|
homepage: http://evan.tiggerpalace.com/
|
51
|
-
licenses:
|
52
51
|
post_install_message:
|
53
52
|
rdoc_options:
|
54
53
|
- --charset=UTF-8
|
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
68
|
requirements: []
|
70
69
|
|
71
70
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.2.0
|
73
72
|
signing_key:
|
74
73
|
specification_version: 3
|
75
74
|
summary: Behaviour Driven Development derived from Cucumber but as an internal DSL with methods for reuse
|