spicycode-micronaut 0.1.7.1 → 0.1.7.2
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 +1 -1
- data/lib/micronaut/behaviour.rb +1 -1
- data/lib/micronaut/configuration.rb +3 -2
- data/lib/micronaut/world.rb +12 -5
- metadata +1 -1
data/Rakefile
CHANGED
data/lib/micronaut/behaviour.rb
CHANGED
@@ -8,7 +8,7 @@ module Micronaut
|
|
8
8
|
attr_reader :before_and_afters
|
9
9
|
|
10
10
|
# Allows you to control what examples are ran by filtering
|
11
|
-
attr_reader :
|
11
|
+
attr_reader :filter
|
12
12
|
|
13
13
|
# Modules that will be included or extended based on given filters
|
14
14
|
attr_reader :include_or_extend_modules
|
@@ -27,6 +27,7 @@ module Micronaut
|
|
27
27
|
@before_and_afters = { :before => { :each => [], :all => [] }, :after => { :each => [], :all => [] } }
|
28
28
|
@include_or_extend_modules = []
|
29
29
|
@formatter_to_use = Micronaut::Formatters::ProgressFormatter
|
30
|
+
@filter = nil
|
30
31
|
end
|
31
32
|
|
32
33
|
# E.g. alias_example_to :crazy_slow, :speed => 'crazy_slow' defines
|
@@ -69,7 +70,7 @@ module Micronaut
|
|
69
70
|
end
|
70
71
|
|
71
72
|
def filter_run(options={})
|
72
|
-
@
|
73
|
+
@filter = options
|
73
74
|
end
|
74
75
|
|
75
76
|
def run_all_when_everything_filtered?
|
data/lib/micronaut/world.rb
CHANGED
@@ -7,21 +7,28 @@ module Micronaut
|
|
7
7
|
def initialize
|
8
8
|
@behaviours = []
|
9
9
|
end
|
10
|
+
|
11
|
+
def filter
|
12
|
+
Micronaut.configuration.filter
|
13
|
+
end
|
10
14
|
|
11
15
|
def behaviours_to_run
|
12
16
|
return @behaviours_to_run if @behaviours_to_run
|
13
|
-
|
14
|
-
if
|
17
|
+
|
18
|
+
if filter
|
15
19
|
@behaviours_to_run = filter_behaviours
|
16
|
-
|
20
|
+
behaviours_to_run.size == 0 && Micronaut.configuration.run_all_when_everything_filtered?
|
17
21
|
if @behaviours_to_run.size == 0 && Micronaut.configuration.run_all_when_everything_filtered?
|
18
|
-
puts "No behaviours were matched, running all"
|
22
|
+
puts "No behaviours were matched by #{filter.inspect}, running all"
|
19
23
|
# reset the behaviour list to all behaviours, and add back all examples
|
20
24
|
@behaviours_to_run = @behaviours
|
21
25
|
@behaviours.each { |b| b.examples_to_run.replace(b.examples) }
|
26
|
+
else
|
27
|
+
puts "Run filtered using #{filter.inspect}"
|
22
28
|
end
|
23
29
|
else
|
24
30
|
@behaviours_to_run = @behaviours
|
31
|
+
@behaviours.each { |b| b.examples_to_run.replace(b.examples) }
|
25
32
|
end
|
26
33
|
|
27
34
|
@behaviours_to_run
|
@@ -33,7 +40,7 @@ module Micronaut
|
|
33
40
|
|
34
41
|
def filter_behaviours
|
35
42
|
behaviours.inject([]) do |list, b|
|
36
|
-
b.examples_to_run.replace(find(b.examples,
|
43
|
+
b.examples_to_run.replace(find(b.examples, filter).uniq)
|
37
44
|
# Do not add behaviours with 0 examples to run
|
38
45
|
list << (b.examples_to_run.size == 0 ? nil : b)
|
39
46
|
end.compact
|