nimboids-rspec-instafail 0.1.3

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 ADDED
@@ -0,0 +1,20 @@
1
+ task :default => :spec
2
+ require 'spec/rake/spectask'
3
+ Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color --backtrace --debug']}
4
+
5
+ begin
6
+ require 'jeweler'
7
+ project_name = 'nimboids-rspec-instafail'
8
+
9
+ Jeweler::Tasks.new do |gem|
10
+ gem.name = project_name
11
+ gem.summary = "Show failing specs instantly"
12
+ gem.email = "grosser.michael@gmail.com"
13
+ gem.homepage = "http://github.com/nimboids/#{project_name}"
14
+ gem.authors = ["Michael Grosser"]
15
+ end
16
+
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
20
+ end
data/Readme.md ADDED
@@ -0,0 +1,47 @@
1
+ Show failing specs instantly. Show passing spec as green dots as usual.
2
+
3
+ Output
4
+ ======
5
+ ....................................................*....
6
+ 1) ApplicationController#sign_out_and_redirect with JSON should return JSON indicating success
7
+ Failure/Error: json_response = JSON.parse response.body
8
+ A JSON text must at least contain two octets!
9
+ # /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `initialize'
10
+ # /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `new'
11
+ # /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `parse'
12
+ # ./spec/controllers/application_controller_spec.rb:17:in `block (4 levels) in <top (required)>'
13
+ ..................................................................
14
+
15
+ Finished in 650.095614 seconds
16
+
17
+ 1680 examples, 1 failure, 1 pending
18
+
19
+
20
+
21
+ Install
22
+ =======
23
+ As Gem:
24
+ gem install rspec-instafail
25
+
26
+ # spec/spec.opts (.rspec for rspec 2)
27
+ --require rspec/instafail
28
+ --format RSpec::Instafail
29
+
30
+ As plugin:
31
+ rails plugin install git://github.com/grosser/rspec-instafail.git
32
+
33
+ # spec/spec.opts (.rspec for rspec 2)
34
+ --require vendor/plugins/rspec-instafail/lib/rspec/instafail
35
+ --format RSpec::Instafail
36
+
37
+ Authors
38
+ =======
39
+
40
+ ### [Contributors](http://github.com/grosser/rspec-instafail/contributors)
41
+ - [Matthew Willhite](http://github.com/miwillhite)
42
+ - [Jeff Kreeftmeijer](http://jeffkreeftmeijer.com)
43
+
44
+
45
+ [Michael Grosser](http://pragmatig.wordpress.com)
46
+ grosser.michael@gmail.com
47
+ Hereby placed under public domain, do what you want, just do not hold me accountable...
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.3
@@ -0,0 +1,9 @@
1
+ module RSpec
2
+ begin
3
+ require 'rspec/instafail/rspec_2'
4
+ rescue LoadError => try_rspec_1
5
+ require 'rspec/instafail/rspec_1'
6
+ end
7
+
8
+ Instafail::VERSION = File.read( File.join(File.dirname(__FILE__),'..','..','VERSION') ).strip
9
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec/runner/formatter/progress_bar_formatter'
2
+
3
+ module RSpec
4
+ class Instafail < Spec::Runner::Formatter::ProgressBarFormatter
5
+ def example_failed(example, counter, failure)
6
+ short_padding = ' '
7
+ padding = ' '
8
+
9
+ output.puts
10
+ output.puts red("#{short_padding}#{counter}) #{example_group.description} #{example.description}")
11
+ output.puts "#{padding}#{red(failure.exception)}"
12
+
13
+ [*format_backtrace(failure.exception.backtrace)].each do |backtrace_info|
14
+ output.puts insta_gray("#{padding}# #{backtrace_info.strip}")
15
+ end
16
+
17
+ output.flush
18
+ end
19
+
20
+ private
21
+
22
+ # there is a gray() that returns nil, so we use our own...
23
+ def insta_gray(text)
24
+ colour(text, "\e[90m")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'rspec/core/formatters/progress_formatter'
2
+
3
+ module RSpec
4
+ class Instafail < RSpec::Core::Formatters::ProgressFormatter
5
+ def example_failed(example)
6
+ @counter ||= 0
7
+ @counter += 1
8
+ exception = example.metadata[:execution_result][:exception_encountered]
9
+ short_padding = ' '
10
+ padding = ' '
11
+ output.puts
12
+ output.puts "#{short_padding}#{@counter}) #{example.full_description}"
13
+ output.puts "#{padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
14
+ output.puts "#{padding}#{red(exception)}"
15
+ format_backtrace(exception.backtrace, example).each do |backtrace_info|
16
+ output.puts grey("#{padding}# #{backtrace_info}")
17
+ end
18
+ output.flush
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,49 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rspec-instafail}
8
+ s.version = "0.1.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Michael Grosser"]
12
+ s.date = %q{2010-11-15}
13
+ s.email = %q{grosser.michael@gmail.com}
14
+ s.files = [
15
+ "Rakefile",
16
+ "Readme.md",
17
+ "VERSION",
18
+ "lib/rspec/instafail.rb",
19
+ "rspec-instafail.gemspec",
20
+ "spec/instafail_spec.rb",
21
+ "spec/rspec_1/Gemfile",
22
+ "spec/rspec_1/Gemfile.lock",
23
+ "spec/rspec_1/a_test.rb",
24
+ "spec/rspec_2/Gemfile",
25
+ "spec/rspec_2/Gemfile.lock",
26
+ "spec/rspec_2/a_test.rb"
27
+ ]
28
+ s.homepage = %q{http://github.com/grosser/rspec-instafail}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.6}
32
+ s.summary = %q{Show failing specs instantly}
33
+ s.test_files = [
34
+ "spec/rspec_1/a_test.rb",
35
+ "spec/rspec_2/a_test.rb",
36
+ "spec/instafail_spec.rb"
37
+ ]
38
+
39
+ if s.respond_to? :specification_version then
40
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
44
+ else
45
+ end
46
+ else
47
+ end
48
+ end
49
+
@@ -0,0 +1,77 @@
1
+ describe 'RSpec::Instafail' do
2
+ it "works correctly with RSpec 1.x" do
3
+ output = `cd spec/rspec_1 && bundle exec spec a_test.rb --format RSpec::Instafail`
4
+ expected_output = <<EXP
5
+ 1\\) x a
6
+ expected: 2,
7
+ got: 1 \\(using ==\\)
8
+ # (\\.\\/)?a_test\\.rb:5:(in `block \\(2 levels\\) in <top \\(required\\)>')?
9
+ \\.\\.\\*\\.
10
+
11
+ Pending:
12
+
13
+ x d \\(TODO\\)
14
+ (\\.\\/)?a_test\\.rb:14(\:in `block in <top \\(required\\)>')?
15
+
16
+ 1\\)
17
+ 'x a' FAILED
18
+ expected: 2,
19
+ got: 1 \\(using ==\\)
20
+ (\\./)?a_test\\.rb:5:(in `block \\(2 levels\\) in <top \\(required\\)>')?
21
+ EXP
22
+
23
+ output.should =~ Regexp.new(expected_output, 'x')
24
+ end
25
+
26
+ it "works correctly with RSpec 2.x (but backtrace might be broken)" do
27
+ output = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color`
28
+ expected = <<EXP
29
+ 1\\) x a
30
+ Failure\\/Error: 1\\.should == 2
31
+ expected: 2,
32
+ got: 1 \\(using ==\\)
33
+ EXP
34
+ output.should =~ Regexp.new(expected, 'x')
35
+
36
+ output.should include('/a_test.rb:5')
37
+
38
+ expected = <<EXP
39
+ \\.\\.\\*\\.
40
+
41
+ Pending:
42
+ x d
43
+ # No reason given
44
+ # \\./a_test\\.rb:14
45
+
46
+ Finished in \\d\\.\\d+ seconds
47
+ 5 examples, 1 failure, 1 pending
48
+ EXP
49
+ output.should =~ Regexp.new(expected, 'x')
50
+
51
+ end
52
+
53
+ it "works correctly with RSpec 2.x" do
54
+ pending 'the backtrace for the error is always absolute on my machine'
55
+ output = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color`
56
+ expected_output = <<EXP
57
+ 1\\) x a
58
+ Failure\\/Error: 1\\.should == 2
59
+ expected: 2,
60
+ got: 1 \\(using ==\\)
61
+ # \\./a_test\\.rb:5
62
+ \\.\\.\\*\\.
63
+
64
+ Pending:
65
+ x d
66
+ # No reason given
67
+ # \\./a_test\\.rb:14
68
+
69
+ Finished in \\d\\.\\d+ seconds
70
+ 5 examples, 1 failure, 1 pending
71
+ EXP
72
+
73
+ output.should =~ Regexp.new(expected_output, 'x')
74
+
75
+ end
76
+ end
77
+
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gem 'rspec', '1.3.0'
@@ -0,0 +1,10 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ rspec (1.3.0)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ rspec (= 1.3.0)
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rspec', 'instafail'))
2
+
3
+ describe 'x' do
4
+ it 'a' do
5
+ 1.should == 2
6
+ end
7
+
8
+ it 'b' do
9
+ end
10
+
11
+ it 'c' do
12
+ end
13
+
14
+ it 'd' do
15
+ pending
16
+ raise
17
+ end
18
+
19
+ it 'e' do
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gem 'rspec', '>=2'
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ rspec (2.0.1)
6
+ rspec-core (~> 2.0.1)
7
+ rspec-expectations (~> 2.0.1)
8
+ rspec-mocks (~> 2.0.1)
9
+ rspec-core (2.0.1)
10
+ rspec-expectations (2.0.1)
11
+ diff-lcs (>= 1.1.2)
12
+ rspec-mocks (2.0.1)
13
+ rspec-core (~> 2.0.1)
14
+ rspec-expectations (~> 2.0.1)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ rspec (>= 2)
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rspec', 'instafail'))
2
+
3
+ describe 'x' do
4
+ it 'a' do
5
+ 1.should == 2
6
+ end
7
+
8
+ it 'b' do
9
+ end
10
+
11
+ it 'c' do
12
+ end
13
+
14
+ it 'd' do
15
+ pending
16
+ raise
17
+ end
18
+
19
+ it 'e' do
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nimboids-rspec-instafail
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 3
10
+ version: 0.1.3
11
+ platform: ruby
12
+ authors:
13
+ - Michael Grosser
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-29 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: grosser.michael@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - Rakefile
32
+ - Readme.md
33
+ - VERSION
34
+ - lib/rspec/instafail.rb
35
+ - lib/rspec/instafail/rspec_1.rb
36
+ - lib/rspec/instafail/rspec_2.rb
37
+ - rspec-instafail.gemspec
38
+ - spec/instafail_spec.rb
39
+ - spec/rspec_1/Gemfile
40
+ - spec/rspec_1/Gemfile.lock
41
+ - spec/rspec_1/a_test.rb
42
+ - spec/rspec_2/Gemfile
43
+ - spec/rspec_2/Gemfile.lock
44
+ - spec/rspec_2/a_test.rb
45
+ has_rdoc: true
46
+ homepage: http://github.com/nimboids/nimboids-rspec-instafail
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.7
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Show failing specs instantly
79
+ test_files:
80
+ - spec/instafail_spec.rb
81
+ - spec/rspec_1/a_test.rb
82
+ - spec/rspec_2/a_test.rb