mini_backtrace 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ 1.9.2@mini_backtrace
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Ken Collins, <ken@metaskills.net>
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+
2
+ = MiniBacktrace
3
+
4
+ A minimal backtrace filter for MiniTest::Unit & Rails. If you have been using Rails 3 with Ruby 1.9, that means your test base test library is MiniTest::Unit. But since Rails 3 there have been no backtrace silencers included in ActiveSupport for the ActiveSupport::BacktraceCleaner (aka Rails.backtrace_cleaner) to hook into MiniTest::Unit. That means noisy tests.
5
+
6
+
7
+
8
+ = Install
9
+
10
+ $ gem install mini_backtrace
11
+
12
+
13
+ = Code
14
+
15
+ * http://github.com/metaskills/mini_backtrace
16
+
17
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs = ['lib','test']
8
+ t.test_files = Dir.glob("test/**/*_test.rb").sort
9
+ t.verbose = true
10
+ end
11
+
12
+ task :default => [:test]
13
+
@@ -0,0 +1,3 @@
1
+ require 'rails'
2
+ require 'minitest/unit'
3
+ require 'mini_backtrace/unit'
@@ -0,0 +1,13 @@
1
+ module MiniTest
2
+
3
+ def self.filter_backtrace_with_rails(bt)
4
+ filter_backtrace_without_rails(Rails.backtrace_cleaner.clean(bt))
5
+ end
6
+
7
+ class << self
8
+ alias :filter_backtrace_without_rails :filter_backtrace
9
+ alias :filter_backtrace :filter_backtrace_with_rails
10
+ end
11
+
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+ module MiniBacktrace
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mini_backtrace/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'mini_backtrace'
7
+ s.version = MiniBacktrace::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Ken Collins']
10
+ s.email = ['ken@metaskills.net']
11
+ s.homepage = 'http://github.com/metaskills/mini_backtrace'
12
+ s.summary = 'MiniBacktrace - A minimal backtrace filter for MiniTest::Unit & Rails.'
13
+ s.description = 'MiniBacktrace - A minimal backtrace filter for MiniTest::Unit & Rails.'
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ['lib']
18
+ s.add_dependency('minitest', '> 1.2.0')
19
+ s.add_dependency('rails', '> 2.3.2')
20
+ end
21
+
data/test/rail_test.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+
3
+ class RailsTest < MiniTest::Spec
4
+
5
+ before do
6
+ @cleaner = Rails.backtrace_cleaner
7
+ end
8
+
9
+ after do
10
+ @cleaner.remove_silencers!
11
+ @cleaner.remove_filters!
12
+ end
13
+
14
+ it 'load rails' do
15
+ @cleaner.must_be_instance_of Rails::BacktraceCleaner
16
+ end
17
+
18
+ it 'should use rails backtrace silencer' do
19
+ @cleaner.add_silencer { |line| line =~ /noisy/ }
20
+ noisy_traces = ["gems/noisy-4.2.0/lib/noisy.rb", "gems/noisy-4.2.0/lib/cricket.rb"]
21
+ good_traces = ["test/rail_test.rb"]
22
+ bt = noisy_traces + good_traces
23
+ MiniTest.filter_backtrace(bt).must_equal good_traces
24
+ end
25
+
26
+
27
+ end
28
+
@@ -0,0 +1,7 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+ require 'mini_backtrace'
4
+ require 'minitest/spec'
5
+ require 'minitest/autorun'
6
+
7
+
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mini_backtrace
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Ken Collins
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-22 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: minitest
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 1.2.0
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">"
34
+ - !ruby/object:Gem::Version
35
+ version: 2.3.2
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ description: MiniBacktrace - A minimal backtrace filter for MiniTest::Unit & Rails.
39
+ email:
40
+ - ken@metaskills.net
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files: []
46
+
47
+ files:
48
+ - .gitignore
49
+ - .rvmrc
50
+ - Gemfile
51
+ - MIT-LICENSE
52
+ - README.rdoc
53
+ - Rakefile
54
+ - lib/mini_backtrace.rb
55
+ - lib/mini_backtrace/unit.rb
56
+ - lib/mini_backtrace/version.rb
57
+ - mini_backtrace.gemspec
58
+ - test/rail_test.rb
59
+ - test/test_helper.rb
60
+ has_rdoc: true
61
+ homepage: http://github.com/metaskills/mini_backtrace
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.6.2
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: MiniBacktrace - A minimal backtrace filter for MiniTest::Unit & Rails.
88
+ test_files:
89
+ - test/rail_test.rb
90
+ - test/test_helper.rb