elight-coulda 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -5,3 +5,7 @@ Initial release with basic features to generate tests from internal DSL
5
5
  0.1.1
6
6
  -----
7
7
  Corrections for github gem build process
8
+
9
+ 0.1.2 && 0.1.3
10
+ --------------
11
+ Cleanup
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ require 'rake/testtask'
4
4
  require 'rake/rdoctask'
5
5
  require 'rake/gempackagetask'
6
6
 
7
+ gem 'thoughtbot-shoulda'
7
8
  require 'shoulda'
8
9
 
9
10
  # Test::Unit::UI::VERBOSE
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.4
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.1.1"
8
+ s.version = "0.1.4"
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"]
@@ -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
- # Allow scenario-less features not to fail
56
- def default_test; end
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|
@@ -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
- if @validating_semantics
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
@@ -2,6 +2,9 @@ module Coulda
2
2
  SyntaxError = Class.new(StandardError)
3
3
  end
4
4
 
5
+
6
+ require 'test/unit'
7
+
5
8
  gem 'jeremymcanally-pending', '>= 0.1'
6
9
  require 'pending'
7
10
 
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
- result = Test::Unit::TestResult.new
6
- p = Proc.new {}
7
- feature.suite.run(result, &p)
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.passed?, result.inspect)
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
- assert(@feature_without_errors.instance_methods.include?("test_pending_scenario"), "Feature is missing test method from scenario")
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.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.3.5
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