rspec_spinner 0.4.8 → 0.5.1

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/Manifest.txt CHANGED
@@ -12,6 +12,8 @@ rspec_spinner.gemspec
12
12
  script/console
13
13
  script/destroy
14
14
  script/generate
15
+ spec/rspec_spinner/base_spec.rb
16
+ spec/rspec_spinner/spinner_spec.rb
15
17
  spec/rspec_spinner_spec.rb
16
18
  spec/spec.opts
17
19
  spec/spec_helper.rb
data/README.rdoc CHANGED
@@ -12,7 +12,7 @@ Adds an extra formatter that looks like this:
12
12
 
13
13
  Or this:
14
14
 
15
- 46% \ ETA: 00:00:23
15
+ 46% \ should get Bar ETA: 00:00:23
16
16
 
17
17
 
18
18
  No dots and Fs, just what you need to know: FAILURES, PENDINGS and SLOW ones.
@@ -46,7 +46,7 @@ Have fun!
46
46
 
47
47
  == REQUIREMENTS:
48
48
 
49
- * rspec
49
+ * rspec (http://github.com/dchemlinksy/rspec)
50
50
  * rtui (http://github.com/nofxx/rtui)
51
51
 
52
52
 
data/Rakefile CHANGED
@@ -5,8 +5,8 @@ require File.dirname(__FILE__) + '/lib/rspec_spinner'
5
5
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
6
  $hoe = Hoe.new('rspec_spinner', RspecSpinner::VERSION) do |p|
7
7
  p.developer('Marcos Piccinini', 'x@nofxx.com')
8
- p.summary = "Some extra formatters for rspec"
9
- p.description = "Some extra formatters for rspec"
8
+ p.summary = "Extra formatters for Rspec"
9
+ p.description = "Extra formatters for Rspec"
10
10
  p.url = "http://github.com/nofxx/postgis_adapter"
11
11
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
12
12
  p.post_install_message = 'PostInstall.txt'
data/lib/rspec_spinner.rb CHANGED
@@ -6,7 +6,7 @@ require "rspec_spinner/spinner"
6
6
  require "rspec_spinner/bar"
7
7
 
8
8
  module RspecSpinner
9
- VERSION = '0.4.8'
9
+ VERSION = '0.5.1'
10
10
  end
11
11
 
12
12
  #module Spec
@@ -46,10 +46,6 @@ module RspecSpinner
46
46
  end
47
47
 
48
48
  def start_dump
49
- @pbar.subject = ""
50
- with_color do
51
- @pbar.finish
52
- end
53
49
  output.flush
54
50
  end
55
51
 
@@ -94,6 +90,7 @@ module RspecSpinner
94
90
  :all_passing => "\e[32m", # green
95
91
  :some_pending => "\e[33m", # yellow
96
92
  :some_failed => "\e[31m", # red
93
+ :pending_fix => "\e[34m", # blue
97
94
  }
98
95
 
99
96
  def with_color
@@ -1,7 +1,6 @@
1
1
  module RspecSpinner
2
2
  class Spinner < RspecSpinnerBase
3
3
 
4
-
5
4
  def start(example_count)
6
5
  @current = 0
7
6
  @total = example_count
@@ -12,10 +11,10 @@ module RspecSpinner
12
11
  end
13
12
 
14
13
  def example_started(example)
15
- # this is strange , w/o this mouth work, you got some weird lines
16
- desc = example.description.to_s.chop.chomp.chop
14
+ desc = example.description.gsub(/\r|\n/, "")
17
15
  @pbar.subject = desc
18
16
  super
19
17
  end
18
+
20
19
  end
21
20
  end
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rspec_spinner}
5
- s.version = "0.4.8"
5
+ s.version = "0.5.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Marcos Piccinini"]
9
- s.date = %q{2008-12-22}
10
- s.description = %q{Some extra formatters for rspec}
9
+ s.date = %q{2009-01-10}
10
+ s.description = %q{Extra formatters for Rspec}
11
11
  s.email = ["x@nofxx.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
- s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "lib/rspec_spinner.rb", "lib/rspec_spinner/bar.rb", "lib/rspec_spinner/base.rb", "lib/rspec_spinner/spinner.rb", "rspec_spinner.gemspec", "script/console", "script/destroy", "script/generate", "spec/rspec_spinner_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
13
+ s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "lib/rspec_spinner.rb", "lib/rspec_spinner/bar.rb", "lib/rspec_spinner/base.rb", "lib/rspec_spinner/spinner.rb", "rspec_spinner.gemspec", "script/console", "script/destroy", "script/generate", "spec/rspec_spinner/base_spec.rb", "spec/rspec_spinner/spinner_spec.rb", "spec/rspec_spinner_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/nofxx/postgis_adapter}
16
16
  s.post_install_message = %q{PostInstall.txt}
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
  s.rubyforge_project = %q{rspec_spinner}
20
20
  s.rubygems_version = %q{1.3.1}
21
- s.summary = %q{Some extra formatters for rspec}
21
+ s.summary = %q{Extra formatters for Rspec}
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -27,18 +27,18 @@ Gem::Specification.new do |s|
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<rspec>, [">= 1.1.11"])
29
29
  s.add_runtime_dependency(%q<rtui>, [">= 0.1.8"])
30
- s.add_development_dependency(%q<newgem>, [">= 1.2.1"])
30
+ s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
31
31
  s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
32
32
  else
33
33
  s.add_dependency(%q<rspec>, [">= 1.1.11"])
34
34
  s.add_dependency(%q<rtui>, [">= 0.1.8"])
35
- s.add_dependency(%q<newgem>, [">= 1.2.1"])
35
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
36
36
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
37
37
  end
38
38
  else
39
39
  s.add_dependency(%q<rspec>, [">= 1.1.11"])
40
40
  s.add_dependency(%q<rtui>, [">= 0.1.8"])
41
- s.add_dependency(%q<newgem>, [">= 1.2.1"])
41
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
42
42
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
43
43
  end
44
44
  end
@@ -0,0 +1,117 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Base" do
4
+
5
+ before(:each) do
6
+ @io = StringIO.new
7
+ @options = mock('options')
8
+ @options.stub!(:dry_run).and_return(false)
9
+ @options.stub!(:colour).and_return(false)
10
+ @formatter = RspecSpinner::Bar.new(@options, @io)
11
+ end
12
+
13
+ it "should produce line break on start dump" do
14
+ @formatter.start_dump
15
+ @io.string.should eql("")
16
+ end
17
+
18
+ it "should produce standard summary without pending when pending has a 0 count" do
19
+ @formatter.dump_summary(3, 2, 1, 0)
20
+ @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
21
+ end
22
+
23
+ describe "Examples" do
24
+
25
+ before(:all) do
26
+ class PassingGroup; end
27
+ class PendingGroup; end
28
+ @passing_group = PassingGroup.describe("passing_group") do
29
+ specify "passing" do
30
+ true.should be_true
31
+ end
32
+ end
33
+ @pending_group = PendingGroup.describe("pending_group") do
34
+ specify "pending" do
35
+ end
36
+ end
37
+ end
38
+
39
+ it "should produce standard summary" do
40
+ example = @pending_group.examples.first
41
+ @formatter.start(1)
42
+ @formatter.example_pending(example, "message", "file/here:35")
43
+ @io.rewind
44
+ @formatter.dump_summary(3, 2, 1, 1)
45
+ @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure, 1 pending\n \r1 examples: 0% | | ETA: --:--:--\r\e[KPENDING SPEC: pending (message)\n Called from file/here:35:\n\n1/1: 100% |====================================================| ETA: 00:00:00\r")
46
+ end
47
+
48
+ it "should update status and go green for passing spec" do
49
+ pending
50
+ @example = mock("Example", :description => "Foo") #@passing_group.examples.first
51
+ @io.should_receive(:tty?).and_return(true)
52
+ @options.should_receive(:colour).and_return(true)
53
+ @formatter.start(1)
54
+ #@formatter.example_started(example)
55
+ @formatter.example_passed(@example)
56
+ @io.string.should == "\e[32m.\e[0m"
57
+ end
58
+
59
+ it "should output failure spec immediately (in red)" do
60
+ @io.should_receive(:tty?).and_return(true)
61
+ @options.should_receive(:colour).and_return(true)
62
+ @formatter.start(1)
63
+ @mock_fail = mock("Fail", :__full_description => "Very Failed")
64
+ @formatter.example_failed("spec", 98, Spec::Runner::Reporter::Failure.new(@mock_fail, Spec::Expectations::ExpectationNotMetError.new))
65
+ @io.string.should eql("\r \r1 examples: 0% | | ETA: --:--:--\r\e[K\n98) \e[31m'Very Failed' FAILED\nSpec::Expectations::ExpectationNotMetError\e[0m\n\n\n1/1: 100% |====================================================| ETA: 00:00:00\r")
66
+ end
67
+
68
+ it "should push magenta for error spec" do
69
+ @io.should_receive(:tty?).and_return(true)
70
+ @options.should_receive(:colour).and_return(true)
71
+ @formatter.start(1)
72
+ @mock_fail = mock("Fail", :__full_description => "Error Failed")
73
+ @formatter.example_failed("spec", 98, Spec::Runner::Reporter::Failure.new(@mock_fail, RuntimeError.new))
74
+ @io.string.should eql("\r \r1 examples: 0% | | ETA: --:--:--\r\e[K\n98) \e[35mRuntimeError in 'Error Failed'\nRuntimeError\e[0m\n\n\n1/1: 100% |====================================================| ETA: 00:00:00\r")
75
+ end
76
+
77
+ it "should push blue for fixed pending spec" do
78
+ @io.should_receive(:tty?).and_return(true)
79
+ @options.should_receive(:colour).and_return(true)
80
+ @formatter.start(1)
81
+ @mock_fail = mock("Fail", :__full_description => "Pending Fixed")
82
+ @formatter.example_failed("spec", 98, Spec::Runner::Reporter::Failure.new(@mock_fail, Spec::Example::PendingExampleFixedError.new))
83
+ @io.string.should eql("\r \r1 examples: 0% | | ETA: --:--:--\r\e[K\n98) \e[34m'Pending Fixed' FIXED\nSpec::Example::PendingExampleFixedError\e[0m\n\n\n1/1: 100% |====================================================| ETA: 00:00:00\r")
84
+ end
85
+
86
+ it "should push slow specs" do
87
+ pending
88
+ @io.should_receive(:tty?).and_return(true)
89
+ @options.should_receive(:colour).and_return(true)
90
+ @formatter.start(1)
91
+ @mock_slow = mock("Slow", :description => "Pending Fixed")
92
+ @formatter.example_started(@mock_slow)
93
+ @formatter.example_passed(@mock_slow)
94
+ @formatter.example_failed("spec", 98, Spec::Runner::Reporter::Failure.new(@mock_fail, Spec::Example::PendingExampleFixedError.new))
95
+ @io.string.should eql("\r \r1 examples: 0% | | ETA: --:--:--\r\e[K\n98) \e[34m'Pending Fixed' FIXED\nSpec::Example::PendingExampleFixedError\e[0m\n\n\n1/1: 100% |====================================================| ETA: 00:00:00\r")
96
+ end
97
+
98
+ it "should push some stuff on start" do
99
+ @formatter.start(4)
100
+ @io.string.should eql("\r \r4 examples: 0% | | ETA: --:--:--\r")
101
+ end
102
+
103
+ it "should not dump anything on the end" do
104
+ @formatter.dump_failure.should be_nil
105
+ end
106
+
107
+ it "should ignore method missing" do
108
+ @formatter.method_missing(:foo).should be_nil
109
+ end
110
+
111
+ it "should erase current line" do
112
+ @formatter.erase_current_line
113
+ @io.string.should eql("\e[K")
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Spinner" do
4
+
5
+ before(:each) do
6
+ class PassingGroup; end
7
+ @passing_group = PassingGroup.describe("passing_group") do
8
+ specify "passing" do
9
+ true.should be_true
10
+ end
11
+ end
12
+ @io = StringIO.new
13
+ @options = mock('options')
14
+ @options.stub!(:dry_run).and_return(false)
15
+ @options.stub!(:colour).and_return(false)
16
+ @formatter = RspecSpinner::Spinner.new(@options, @io)
17
+ end
18
+
19
+ it "should print the description on the avaiable space" do
20
+ @mock_pbar = mock("ProgressBar")
21
+ Rtui::Progress.should_receive(:new).and_return(@mock_pbar)
22
+ @mock_pbar.should_receive("subject=").with("Starting...")
23
+ @formatter.start(1)
24
+ @mock_pbar.should_receive("subject=").with("passing")
25
+ @formatter.example_started(@passing_group.examples.first)
26
+ end
27
+
28
+ end
@@ -1,11 +1,9 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- # Time to add your specs!
4
- # http://rspec.info/
5
3
  describe "Place your specs here" do
6
4
 
7
- it "find this spec in spec directory" do
8
- violated "Be sure to write your specs"
5
+ it "should integrate better" do
6
+ pending
9
7
  end
10
8
 
11
9
  end
data/spec/spec.opts CHANGED
@@ -1 +1,2 @@
1
- --colour
1
+ --colour
2
+ --diff
data/spec/spec_helper.rb CHANGED
@@ -7,4 +7,4 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
- require 'rspec-spinner'
10
+ require 'rspec_spinner'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_spinner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-22 00:00:00 -02:00
12
+ date: 2009-01-10 00:00:00 -02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.2.1
43
+ version: 1.2.3
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: hoe
@@ -52,7 +52,7 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.8.0
54
54
  version:
55
- description: Some extra formatters for rspec
55
+ description: Extra formatters for Rspec
56
56
  email:
57
57
  - x@nofxx.com
58
58
  executables: []
@@ -79,6 +79,8 @@ files:
79
79
  - script/console
80
80
  - script/destroy
81
81
  - script/generate
82
+ - spec/rspec_spinner/base_spec.rb
83
+ - spec/rspec_spinner/spinner_spec.rb
82
84
  - spec/rspec_spinner_spec.rb
83
85
  - spec/spec.opts
84
86
  - spec/spec_helper.rb
@@ -109,6 +111,6 @@ rubyforge_project: rspec_spinner
109
111
  rubygems_version: 1.3.1
110
112
  signing_key:
111
113
  specification_version: 2
112
- summary: Some extra formatters for rspec
114
+ summary: Extra formatters for Rspec
113
115
  test_files: []
114
116