spicycode-micronaut 0.1.4.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
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.4.4"
6
+ GEM_VERSION = "0.1.5"
7
7
  AUTHOR = "Chad Humphries"
8
8
  EMAIL = "chad@spicycode.com"
9
9
  HOMEPAGE = "http://spicycode.com"
data/bin/micronaut CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
2
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
3
3
  require 'micronaut'
4
4
  Micronaut.configuration.autorun!
@@ -57,12 +57,12 @@ describe Micronaut::Formatters::ProgressFormatter do
57
57
  @output.string.should == ""
58
58
  end
59
59
 
60
- it "should ensure two ':' in the first backtrace" do
60
+ it "should ensure ':' in the first backtrace" do
61
61
  backtrace = ["/tmp/x.rb:1", "/tmp/x.rb:2", "/tmp/x.rb:3"]
62
- @formatter.format_backtrace(backtrace).should == "/tmp/x.rb:1"
62
+ @formatter.format_backtrace(backtrace).should == backtrace
63
63
 
64
64
  backtrace = ["/tmp/x.rb:1: message", "/tmp/x.rb:2", "/tmp/x.rb:3"]
65
- @formatter.format_backtrace(backtrace).should == "/tmp/x.rb:1: message"
65
+ @formatter.format_backtrace(backtrace).first.should == "/tmp/x.rb:1: message"
66
66
  end
67
67
 
68
68
  end
@@ -2,4 +2,40 @@ require File.expand_path(File.dirname(__FILE__) + "/../../example_helper")
2
2
 
3
3
  describe Micronaut::Runner do
4
4
 
5
+ before do
6
+ @runner = Micronaut::Runner.new
7
+ end
8
+
9
+ describe '#configuration' do
10
+
11
+ it "should return Micronaut.configuration" do
12
+ @runner.configuration.should == Micronaut.configuration
13
+ end
14
+
15
+ end
16
+
17
+ describe '#formatter' do
18
+
19
+ it 'should return the configured formatter' do
20
+ @runner.formatter.should == Micronaut.configuration.formatter
21
+ end
22
+
23
+ end
24
+
25
+ describe 'Micronaut::Runner.at_exit' do
26
+
27
+ it 'should set an at_exit hook if none is already set' do
28
+ Micronaut::Runner.stubs(:installed_at_exit?).returns(false)
29
+ Micronaut::Runner.expects(:at_exit)
30
+ Micronaut::Runner.autorun
31
+ end
32
+
33
+ it 'should not set the at_exit hook if it is already set' do
34
+ Micronaut::Runner.stubs(:installed_at_exit?).returns(true)
35
+ Micronaut::Runner.expects(:at_exit).never
36
+ Micronaut::Runner.autorun
37
+ end
38
+
39
+ end
40
+
5
41
  end
@@ -23,7 +23,7 @@ module Micronaut
23
23
 
24
24
 
25
25
  def initialize
26
- @backtrace_clean_patterns = [/\/lib\/ruby\//, /bin\/rcov:/, /vendor\/rails/]
26
+ @backtrace_clean_patterns = [/\/lib\/ruby\//, /bin\/rcov:/, /vendor\/rails/, /bin\/micronaut/]
27
27
  @profile_examples = false
28
28
  @run_all_when_everything_filtered = true
29
29
  @filter = nil
@@ -31,7 +31,7 @@ module Micronaut
31
31
  end
32
32
 
33
33
  def cleaned_from_backtrace?(line)
34
- return true if line.starts_with?(::Micronaut::InstallDirectory)
34
+ return true if line =~ /#{::Micronaut::InstallDirectory}/
35
35
 
36
36
  @backtrace_clean_patterns.any? do |pattern|
37
37
  line =~ pattern
@@ -107,7 +107,7 @@ module Micronaut
107
107
  def format_backtrace(backtrace)
108
108
  return "" if backtrace.nil?
109
109
  cleansed = backtrace.map { |line| backtrace_line(line) }.compact
110
- cleansed.empty? ? backtrace.join("\n") : cleansed.first
110
+ cleansed.empty? ? backtrace : cleansed
111
111
  end
112
112
 
113
113
  protected
@@ -121,7 +121,7 @@ module Micronaut
121
121
 
122
122
  def read_failed_line(file_path_with_line_number)
123
123
  file_path, line_number = file_path_with_line_number.split(':')
124
- open(file_path, 'r') { |f| f.readlines[line_number.to_i + 1].strip }
124
+ open(file_path, 'r') { |f| f.readlines[line_number.to_i - 1] }
125
125
  end
126
126
 
127
127
  end
@@ -31,9 +31,11 @@ module Micronaut
31
31
  example, exception = examples_with_exception.first, examples_with_exception.last
32
32
  padding = ' '
33
33
  output.puts "#{index.next}) #{example}"
34
- # output.puts "#{padding}failing statement: #{read_failed_line(example.options[:caller])}\n"
35
- output.puts "#{padding}#{colorise(exception.message, exception).strip}"
36
- output.puts grey("#{padding}# #{format_backtrace(exception.backtrace)}")
34
+ output.puts "#{padding}#{colorise(exception.message, exception).strip}\n\n"
35
+ output.puts "#{padding}failing statement: #{read_failed_line(exception.backtrace[4]).strip}"
36
+ format_backtrace(exception.backtrace).each do |backtrace_info|
37
+ output.puts grey("#{padding}# #{backtrace_info}")
38
+ end
37
39
  output.puts
38
40
  output.flush
39
41
  end
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.4.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Humphries