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 CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
  require 'rubygems/specification'
4
4
 
5
5
  GEM = "micronaut"
6
- GEM_VERSION = "0.1.7.1"
6
+ GEM_VERSION = "0.1.7.2"
7
7
  AUTHOR = "Chad Humphries"
8
8
  EMAIL = "chad@spicycode.com"
9
9
  HOMEPAGE = "http://spicycode.com"
@@ -187,7 +187,7 @@ module Micronaut
187
187
  end
188
188
 
189
189
  def self.run(reporter)
190
- return true if examples.size == 0
190
+ return true if examples.empty?
191
191
 
192
192
  reporter.add_behaviour(self)
193
193
 
@@ -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 :filter_run
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
- @filter_run = options
73
+ @filter = options
73
74
  end
74
75
 
75
76
  def run_all_when_everything_filtered?
@@ -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 Micronaut.configuration.filter_run
17
+
18
+ if filter
15
19
  @behaviours_to_run = filter_behaviours
16
- puts "\nRun filtered using #{Micronaut.configuration.filter_run.inspect}"
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, Micronaut.configuration.filter_run).uniq)
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
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.7.1
4
+ version: 0.1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Humphries