spicycode-micronaut 0.1.9.0 → 0.2.0.0
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/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.
|
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 =
|
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 "#
|
211
|
+
describe "#run_examples" do
|
212
212
|
|
213
|
-
|
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
|
-
|
222
|
+
Micronaut::Behaviour.run_examples(stub_behaviour, stub_everything('reporter')).should == true
|
223
|
+
end
|
216
224
|
|
217
|
-
|
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
|
data/lib/micronaut/behaviour.rb
CHANGED
@@ -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 =
|
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
|