spicycode-micronaut 0.2.1.3 → 0.2.1.4

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.2.1.3"
7
+ GEM_VERSION = "0.2.1.4"
8
8
  AUTHOR = "Chad Humphries"
9
9
  EMAIL = "chad@spicycode.com"
10
10
  HOMEPAGE = "http://github.com/spicycode/micronaut"
@@ -72,4 +72,4 @@ namespace :examples do
72
72
 
73
73
  end
74
74
 
75
- task :default => 'examples:coverage'
75
+ task :default => 'examples:coverage'
@@ -33,12 +33,8 @@ def not_in_editor?
33
33
  ['TM_MODE', 'EMACS', 'VIM'].all? { |k| !ENV.has_key?(k) }
34
34
  end
35
35
 
36
- def runcoderun?
37
- ENV["RUN_CODE_RUN"]
38
- end
39
-
40
36
  Micronaut.configure do |c|
41
- c.formatter = :documentation if runcoderun?
37
+ c.formatter = :documentation
42
38
  c.mock_with :mocha
43
39
  c.color_enabled = not_in_editor?
44
40
  c.filter_run :focused => true
@@ -188,9 +188,9 @@ describe Micronaut::Behaviour do
188
188
 
189
189
  end
190
190
 
191
- describe Object, "describing nested behaviours" do
191
+ describe Object, "describing nested behaviours", :little_less_nested => 'yep' do
192
192
 
193
- describe "A sample nested describe", :just_testing => 'yep' do
193
+ describe "A sample nested describe", :nested_describe => "yep" do
194
194
 
195
195
  it "should set the described type to the constant Object" do
196
196
  running_example.behaviour.describes.should == Object
@@ -200,8 +200,12 @@ describe Micronaut::Behaviour do
200
200
  running_example.behaviour.description.should == 'A sample nested describe'
201
201
  end
202
202
 
203
- it "should have :just_testing => 'yep' in the metadata" do
204
- running_example.behaviour.metadata.should include(:just_testing => 'yep')
203
+ it "should have top level metadata from the behaviour and its ancestors" do
204
+ running_example.behaviour.metadata.should include(:little_less_nested => 'yep', :nested_describe => 'yep')
205
+ end
206
+
207
+ it "should make the parent metadata available on the contained examples" do
208
+ running_example.metadata.should include(:little_less_nested => 'yep', :nested_describe => 'yep')
205
209
  end
206
210
 
207
211
  end
@@ -93,14 +93,14 @@ describe Micronaut::Configuration do
93
93
  it "does nothing if trace is false" do
94
94
  config = Micronaut::Configuration.new
95
95
  config.trace = false
96
- config.output.expects(:puts).never
96
+ config.expects(:puts).with("my trace string is awesome").never
97
97
  config.trace { "my trace string is awesome" }
98
98
  end
99
99
 
100
100
  it "allows overriding tracing an optional param" do
101
101
  config = Micronaut::Configuration.new
102
102
  config.trace = false
103
- config.output.expects(:puts).with(includes("my trace string is awesome"))
103
+ config.expects(:puts).with(includes("my trace string is awesome"))
104
104
  config.trace(true) { "my trace string is awesome" }
105
105
  end
106
106
 
@@ -120,6 +120,7 @@ describe Micronaut::Configuration do
120
120
  config = Micronaut::Configuration.new
121
121
  lambda { config.formatter = :progresss }.should raise_error(ArgumentError)
122
122
  end
123
+
123
124
  end
124
125
 
125
- end
126
+ end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../../example_helper")
2
2
 
3
- describe Micronaut::Example do
3
+ describe Micronaut::Example, :parent_metadata => 'sample' do
4
4
 
5
5
  before do
6
6
  behaviour = stub('behaviour', :metadata => { :behaviour => { :name => 'behaviour_name' }})
@@ -48,6 +48,12 @@ describe Micronaut::Example do
48
48
  it "should have a reference to itself when running" do
49
49
  running_example.description.should == "should have a reference to itself when running"
50
50
  end
51
+
52
+ it "should be able to access the behaviours top level metadata as if it were its own" do
53
+ running_example.metadata.each { |k,v| puts "#{k} => #{v.inspect}\n\n" }
54
+ running_example.behaviour.metadata.should include(:parent_metadata => 'sample')
55
+ running_example.metadata.should include(:parent_metadata => 'sample')
56
+ end
51
57
 
52
58
  end
53
59
 
@@ -77,10 +77,11 @@ module Micronaut
77
77
  end
78
78
 
79
79
  def self.set_it_up(*args)
80
- @metadata = { :behaviour => {} }
80
+ @metadata = { }
81
81
  extra_metadata = args.last.is_a?(Hash) ? args.pop : {}
82
82
  extra_metadata.delete(:behaviour) # Remove it when present to prevent it clobbering the one we setup
83
-
83
+ @metadata.update(self.superclass.metadata)
84
+ @metadata[:behaviour] = {}
84
85
  @metadata[:behaviour][:describes] = args.shift unless args.first.is_a?(String)
85
86
  @metadata[:behaviour][:describes] ||= self.superclass.metadata && self.superclass.metadata[:behaviour][:describes]
86
87
  @metadata[:behaviour][:description] = args.shift || ''
@@ -221,4 +222,4 @@ module Micronaut
221
222
  end
222
223
 
223
224
  end
224
- end
225
+ end
@@ -108,7 +108,11 @@ module Micronaut
108
108
  def trace(override = false)
109
109
  raise(ArgumentError, "Must yield a block with your string to trace.") unless block_given?
110
110
  return unless trace? || override
111
- Micronaut.configuration.output.puts("[TRACE] #{yield}")
111
+ puts("[TRACE] #{yield}")
112
+ end
113
+
114
+ def puts(msg)
115
+ output.puts(msg)
112
116
  end
113
117
 
114
118
  # If true, Micronaut will provide detailed trace output of its self as it runs.
@@ -151,4 +155,4 @@ module Micronaut
151
155
 
152
156
  end
153
157
 
154
- end
158
+ end
@@ -73,4 +73,4 @@ module Micronaut
73
73
 
74
74
  end
75
75
 
76
- end
76
+ end
@@ -29,16 +29,20 @@ module Micronaut
29
29
  def dump_failures
30
30
  output.puts
31
31
  failed_examples.each_with_index do |examples_with_exception, index|
32
- example, exception = examples_with_exception.first, examples_with_exception.last
32
+ failed_example, exception = examples_with_exception.first, examples_with_exception.last
33
33
  padding = ' '
34
- output.puts "#{index.next}) #{example}"
35
- output.puts "#{padding}Failure/Error: #{read_failed_line(exception, example).strip}"
34
+
35
+ output.puts "#{index.next}) #{failed_example}"
36
+ output.puts "#{padding}Failure/Error: #{read_failed_line(exception, failed_example).strip}"
37
+
36
38
  exception.message.split("\n").each do |line|
37
39
  output.puts "#{padding}#{colorise(line, exception).strip}"
38
40
  end
39
- format_backtrace(exception.backtrace, example).each do |backtrace_info|
41
+
42
+ format_backtrace(exception.backtrace, failed_example).each do |backtrace_info|
40
43
  output.puts grey("#{padding}# #{backtrace_info}")
41
44
  end
45
+
42
46
  output.puts
43
47
  output.flush
44
48
  end
@@ -52,7 +52,7 @@ module Micronaut
52
52
  end
53
53
 
54
54
  def current_indentation
55
- ' ' * previous_nested_behaviours.length
55
+ ' ' * previous_nested_behaviours.size
56
56
  end
57
57
 
58
58
  def described_behaviour_chain
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.2.1.3
4
+ version: 0.2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Humphries