spicycode-micronaut 0.0.9 → 0.1.0

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 'date'
5
5
 
6
6
  GEM = "micronaut"
7
- GEM_VERSION = "0.0.9"
7
+ GEM_VERSION = "0.1.0"
8
8
  AUTHOR = "Chad Humphries"
9
9
  EMAIL = "chad@spicycode.com"
10
10
  HOMEPAGE = "http://spicycode.com"
@@ -1,7 +1,19 @@
1
1
  module Micronaut
2
2
 
3
3
  class Configuration
4
- attr_reader :mock_framework
4
+ attr_reader :mock_framework, :backtrace_clean_patterns
5
+
6
+ def initialize
7
+ @backtrace_clean_patterns = [/\/lib\/ruby\//, /bin\/rcov:/, /vendor\/rails/]
8
+ end
9
+
10
+ def cleaned_from_backtrace?(line)
11
+ return true if line.starts_with?(::Micronaut::InstallDirectory)
12
+
13
+ @backtrace_clean_patterns.any? do |pattern|
14
+ line =~ pattern
15
+ end
16
+ end
5
17
 
6
18
  def mock_with(make_a_mockery_with=nil)
7
19
  @mock_framework = case make_a_mockery_with
@@ -3,8 +3,8 @@ module Micronaut
3
3
  class InvalidMatcherError < ArgumentError; end
4
4
 
5
5
  class ExpectationMatcherHandler
6
- class << self
7
- def handle_matcher(actual, matcher, &block)
6
+
7
+ def self.handle_matcher(actual, matcher, &block)
8
8
  ::Micronaut::Matchers.last_should = "should"
9
9
  return Micronaut::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil?
10
10
 
@@ -17,12 +17,12 @@ module Micronaut
17
17
  Micronaut::Expectations.fail_with(matcher.failure_message) unless match
18
18
  match
19
19
  end
20
- end
20
+
21
21
  end
22
22
 
23
23
  class NegativeExpectationMatcherHandler
24
- class << self
25
- def handle_matcher(actual, matcher, &block)
24
+
25
+ def self.handle_matcher(actual, matcher, &block)
26
26
  ::Micronaut::Matchers.last_should = "should not"
27
27
  return Micronaut::Matchers::NegativeOperatorMatcher.new(actual) if matcher.nil?
28
28
 
@@ -44,7 +44,7 @@ EOF
44
44
  Micronaut::Expectations.fail_with(matcher.negative_failure_message) if match
45
45
  match
46
46
  end
47
- end
47
+
48
48
  end
49
49
 
50
50
  end
@@ -88,7 +88,7 @@ module Micronaut
88
88
  end
89
89
 
90
90
  def backtrace_line(line)
91
- return nil if line.rindex(Micronaut::InstallDirectory, 0)
91
+ return nil if Micronaut.configuration.cleaned_from_backtrace?(line)
92
92
  line.sub!(/\A([^:]+:\d+)$/, '\\1')
93
93
  return nil if line == '-e:1'
94
94
  line
data/lib/micronaut.rb CHANGED
@@ -24,8 +24,8 @@ module Micronaut
24
24
  end
25
25
 
26
26
  # './lib' in project dir, or '/usr/local/blahblah' if installed
27
- InstallDirectory = File.expand_path(File.dirname(File.dirname(file)))
28
-
27
+ InstallDirectory = File.expand_path(File.dirname(File.dirname(file)) + "/lib")
28
+ puts InstallDirectory
29
29
  def self.configuration
30
30
  @configuration ||= Micronaut::Configuration.new
31
31
  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.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Humphries
@@ -9,7 +9,7 @@ autorequire: micronaut
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-06 00:00:00 -08:00
12
+ date: 2008-12-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency