rspec-instafail 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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']}
4
+
5
+ begin
6
+ require 'jeweler'
7
+ project_name = '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/grosser/#{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,39 @@
1
+ Show failing specs instantly. Show passing spec as green dots as usual.
2
+
3
+ Output
4
+ ======
5
+ ....................................................*....
6
+ 1: User as seller should be a seller when it has an activated shop
7
+ -> expected is_seller? to return false, got true
8
+ ..................................................................
9
+ 2: Product validations is invalid with too short title
10
+ -> expected not: == 1,
11
+ got: 1
12
+ ............................................................
13
+ Finished in 650.095614 seconds
14
+
15
+ 1680 examples, 2 failure, 1 pending
16
+
17
+
18
+
19
+ Install
20
+ =======
21
+ As Gem:
22
+ gem install rspec-instafail
23
+
24
+ # spec/spec.opts
25
+ --require rspec/instafail
26
+ --format RSpec::Instafail
27
+
28
+ As plugin:
29
+ script/plugin install git://github.com/grosser/rspec-instafail.git
30
+
31
+ # spec/spec.opts
32
+ --require vendor/plugins/rspec-instafail/lib/rspec/instafail
33
+ --format RSpec::Instafail
34
+
35
+ Author
36
+ ======
37
+ [Michael Grosser](http://pragmatig.wordpress.com)
38
+ grosser.michael@gmail.com
39
+ Hereby placed under public domain, do what you want, just do not hold me accountable...
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,32 @@
1
+ module RSpec
2
+ klass = if defined? Spec
3
+ # rspec 1.x
4
+ require 'spec/runner/formatter/progress_bar_formatter'
5
+ class Instafail < Spec::Runner::Formatter::ProgressBarFormatter
6
+ def example_failed(example, counter, failure)
7
+ output.puts
8
+ output.puts red("#{counter}: #{example_group.description} #{example.description}")
9
+ output.puts " -> #{failure.exception}"
10
+ output.flush
11
+ end
12
+ end
13
+ Instafail
14
+ else
15
+ # rspec 2.x
16
+ require 'rspec'
17
+ require 'rspec/core/formatters/progress_formatter'
18
+ class Instafail < RSpec::Core::Formatters::ProgressFormatter
19
+ def example_failed(example)
20
+ @counter ||= 0
21
+ @counter += 1
22
+ output.puts
23
+ output.puts red("#{@counter}: #{example.example_group.description} #{example.description}")
24
+ output.puts " -> #{example.metadata[:execution_result][:exception_encountered]}"
25
+ output.flush
26
+ end
27
+ end
28
+ Instafail
29
+ end
30
+
31
+ klass::VERSION = File.read( File.join(File.dirname(__FILE__),'..','..','VERSION') ).strip
32
+ 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.0"
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-08-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,13 @@
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
+ output.should include("1: x a\n -> expected: 2,\n got: 1 (using ==)\n\.\.\*\.")
5
+ output.should =~ /Finished in \d\.\d+ seconds/
6
+ end
7
+
8
+ it "works correctly with RSpec 2.x" do
9
+ output = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color`
10
+ output.should =~ /1: x a\n -> expected: 2,\n got: 1 .*\.\.\*\./m
11
+ output.should =~ /Finished in \d\.\d+ seconds/
12
+ end
13
+ end
@@ -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.beta.19'
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ rspec (2.0.0.beta.19)
6
+ rspec-core (= 2.0.0.beta.19)
7
+ rspec-expectations (= 2.0.0.beta.19)
8
+ rspec-mocks (= 2.0.0.beta.19)
9
+ rspec-core (2.0.0.beta.19)
10
+ rspec-expectations (2.0.0.beta.19)
11
+ diff-lcs (>= 1.1.2)
12
+ rspec-mocks (2.0.0.beta.19)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ rspec (= 2.0.0.beta.19)
@@ -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,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-instafail
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Michael Grosser
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-15 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email: grosser.michael@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - Rakefile
31
+ - Readme.md
32
+ - VERSION
33
+ - lib/rspec/instafail.rb
34
+ - rspec-instafail.gemspec
35
+ - spec/instafail_spec.rb
36
+ - spec/rspec_1/Gemfile
37
+ - spec/rspec_1/Gemfile.lock
38
+ - spec/rspec_1/a_test.rb
39
+ - spec/rspec_2/Gemfile
40
+ - spec/rspec_2/Gemfile.lock
41
+ - spec/rspec_2/a_test.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/grosser/rspec-instafail
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.6
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Show failing specs instantly
72
+ test_files:
73
+ - spec/rspec_1/a_test.rb
74
+ - spec/rspec_2/a_test.rb
75
+ - spec/instafail_spec.rb