spicycode-micronaut 0.1.9.0 → 0.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rubygems/specification'
4
4
  require 'lib/micronaut/rake_task'
5
5
 
6
6
  GEM = "micronaut"
7
- GEM_VERSION = "0.1.9.0"
7
+ GEM_VERSION = "0.2.0.0"
8
8
  AUTHOR = "Chad Humphries"
9
9
  EMAIL = "chad@spicycode.com"
10
10
  HOMEPAGE = "http://github.com/spicycode/micronaut"
@@ -67,7 +67,7 @@ namespace :examples do
67
67
  Micronaut::RakeTask.new :coverage do |t|
68
68
  t.pattern = "examples/**/*_example.rb"
69
69
  t.rcov = true
70
- t.rcov_opts = "--exclude \"examples/*,gems/*,db/*,/Library/Ruby/*,config/*\" --text-summary --sort coverage --no-validator-links"
70
+ t.rcov_opts = %[--exclude "examples/*,gems/*,db/*,/Library/Ruby/*,config/*" --text-summary --sort coverage --no-validator-links]
71
71
  end
72
72
 
73
73
  end
@@ -208,12 +208,38 @@ describe Micronaut::Behaviour do
208
208
 
209
209
  end
210
210
 
211
- describe "#run" do
211
+ describe "#run_examples" do
212
212
 
213
- pending "should run after(:each) when the example fails"
213
+ def stub_behaviour
214
+ stub_everything('behaviour', :metadata => { :behaviour => { :name => 'behaviour_name' }})
215
+ end
216
+
217
+ it "should return true if all examples pass" do
218
+ passing_example1 = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 1 }))
219
+ passing_example2 = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 1 }))
220
+ Micronaut::Behaviour.stubs(:examples_to_run).returns([passing_example1, passing_example2])
214
221
 
215
- pending "should run after(:each) when the example raises an Exception"
222
+ Micronaut::Behaviour.run_examples(stub_behaviour, stub_everything('reporter')).should == true
223
+ end
216
224
 
217
- end
225
+ it "should return false if any of the examples return false" do
226
+ failing_example = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 2 }))
227
+ passing_example = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 1 }))
228
+ Micronaut::Behaviour.stubs(:examples_to_run).returns([failing_example, passing_example])
229
+
230
+ Micronaut::Behaviour.run_examples(stub_behaviour, stub_everything('reporter')).should == false
231
+ end
232
+
233
+ it "should run all examples, regardless of any of them failing" do
234
+ failing_example = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 2 }))
235
+ passing_example = Micronaut::Example.new(stub_behaviour, 'description', {}, (lambda { 1.should == 1 }))
236
+ Micronaut::Behaviour.stubs(:examples_to_run).returns([failing_example, passing_example])
218
237
 
238
+ passing_example.expects(:run)
239
+
240
+ Micronaut::Behaviour.run_examples(stub_behaviour, stub_everything('reporter'))
241
+ end
242
+
243
+ end
244
+
219
245
  end
@@ -51,4 +51,13 @@ describe Micronaut::Example do
51
51
 
52
52
  end
53
53
 
54
+ describe "#run" do
55
+
56
+ pending "should run after(:each) when the example fails"
57
+
58
+ pending "should run after(:each) when the example raises an Exception"
59
+
60
+ end
61
+
62
+
54
63
  end
@@ -194,11 +194,16 @@ module Micronaut
194
194
  behaviour_instance = new
195
195
  reporter.add_behaviour(self)
196
196
  eval_before_alls(behaviour_instance)
197
- success = examples_to_run.all? { |ex| ex.run(behaviour_instance, reporter) }
197
+ success = run_examples(behaviour_instance, reporter)
198
198
  eval_after_alls(behaviour_instance)
199
199
 
200
200
  success
201
201
  end
202
+
203
+ # Runs all examples, returning true only if all of them pass
204
+ def self.run_examples(behaviour_instance, reporter)
205
+ examples_to_run.map { |ex| ex.run(behaviour_instance, reporter) }.all?
206
+ end
202
207
 
203
208
  def self.subclass(base_name, &body) # :nodoc:
204
209
  @_sub_class_count ||= 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spicycode-micronaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.0
4
+ version: 0.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Humphries