fumullins-formatter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format FumullinsFormatter
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in yodaism.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fumullins-formatter (0.0.0)
5
+ rspec (>= 2.13)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.3)
11
+ rake (10.0.4)
12
+ rspec (2.13.0)
13
+ rspec-core (~> 2.13.0)
14
+ rspec-expectations (~> 2.13.0)
15
+ rspec-mocks (~> 2.13.0)
16
+ rspec-core (2.13.1)
17
+ rspec-expectations (2.13.0)
18
+ diff-lcs (>= 1.1.3, < 2.0)
19
+ rspec-mocks (2.13.1)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ fumullins-formatter!
26
+ rake
data/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2011 Matt Sears
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ This shit is broke right now.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new
Binary file
@@ -0,0 +1,22 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "fumullins-formatter"
5
+ s.version = "0.0.1"
6
+ s.authors = ["willywos"]
7
+ s.email = ["wwilimek@gmail.com"]
8
+ s.homepage = "https://github.com/willywos/fumullins_formatter"
9
+ s.summary = %q{fumullins RSpec formatter!}
10
+ s.description = s.summary
11
+
12
+ s.rubyforge_project = "fumullins-formatter"
13
+
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
+
19
+ s.add_dependency "rspec", ">= 2.13"
20
+
21
+ s.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'rspec/core/formatters/progress_formatter'
4
+
5
+ class FumullinsFormatter < RSpec::Core::Formatters::ProgressFormatter
6
+ def example_failed(example)
7
+ super(example)
8
+ @failure_count =+ 1
9
+ output.print failure_color "umullin"
10
+ end
11
+
12
+ def stop
13
+ super
14
+ print failure_color fumullins if any_failed?
15
+ end
16
+
17
+ def any_failed?
18
+ @failure_count > 0
19
+ end
20
+
21
+ def fumullins
22
+ <<EOF
23
+
24
+
25
+ @@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@@@
26
+ @@! @@! @@@ @@! @@! @@! @@! @@@ @@! @@! @@! @@!@!@@@ !@@
27
+ @!!!:! @!@ !@! @!! !!@ @!@ @!@ !@! @!! @!! !!@ @!@@!!@! !@@!!
28
+ !!: !!: !!! !!: !!: !!: !!! !!: !!: !!: !!: !!! !:!
29
+ : :.:: : : : :.:: : : ::.: : : ::.: : : :: : ::.: :
30
+
31
+ EOF
32
+ end
33
+
34
+ def fumullins_summary(duration)
35
+ message = any_failed? ? "You fumullined" : "Tests completed"
36
+ summary = "\n#{message} in #{format_seconds(duration)} seconds".split(//).map { |c| bold(c) }
37
+ summary.join
38
+ end
39
+
40
+ def dump_summary(duration, example_count, failure_count, pending_count)
41
+ dump_profile if profile_examples? && failure_count == 0
42
+ summary = fumullins_summary(duration)
43
+ output.puts summary
44
+ output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
45
+ end
46
+ end
47
+
@@ -0,0 +1,39 @@
1
+ require 'stringio'
2
+
3
+ describe FumullinsFormatter do
4
+ before do
5
+ @output = StringIO.new
6
+ @formatter = FumullinsFormatter.new(@output)
7
+ @formatter.start(2)
8
+ @example = RSpec::Core::ExampleGroup.describe.example
9
+ end
10
+
11
+ it "should increment the failure count" do
12
+ lambda { @formatter.example_failed(@example)}.
13
+ should change(@formatter, :failure_count).by(1)
14
+ end
15
+
16
+ it "should return true when failure count > 0" do
17
+ @formatter.example_failed(@example)
18
+ @formatter.any_failed?.should eq true
19
+ end
20
+
21
+ it "should return false when failure count is 0" do
22
+ @formatter.any_failed?.should eq false
23
+ end
24
+
25
+ it "should generate a summary with You fumullined if any tests failed" do
26
+ @formatter.stub(:any_failed?).and_return(true)
27
+ @formatter.fumullins_summary(1022).should eq "\nYou fumullined in 1022 seconds"
28
+ end
29
+
30
+ it "should generate a summery with Tests Completed if no tests failed" do
31
+ @formatter.stub(:any_failed?).and_return(false)
32
+ @formatter.fumullins_summary(1022).should eq "\nTests completed in 1022 seconds"
33
+ end
34
+
35
+ it "should return a fumullins in cool ascii art" do
36
+ @formatter.fumullins.should eq "\n\n @@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@@@\n @@! @@! @@@ @@! @@! @@! @@! @@@ @@! @@! @@! @@!@!@@@ !@@ \n @!!!:! @!@ !@! @!! !!@ @!@ @!@ !@! @!! @!! !!@ @!@@!!@! !@@!! \n !!: !!: !!! !!: !!: !!: !!! !!: !!: !!: !!: !!! !:!\n : :.:: : : : :.:: : : ::.: : : ::.: : : :: : ::.: : \n \n"
37
+ end
38
+ end
39
+
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'fumullins_formatter'
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fumullins-formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - willywos
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &1 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2.13'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *1
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &2 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2
36
+ description: fumullins RSpec formatter!
37
+ email:
38
+ - wwilimek@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .rspec
44
+ - Gemfile
45
+ - Gemfile.lock
46
+ - LICENSE.md
47
+ - README.md
48
+ - Rakefile
49
+ - fumullins-formatter-0.0.0.gem
50
+ - fumullins_formatter.gemspec
51
+ - lib/fumullins_formatter.rb
52
+ - spec/fumullins_formatter_spec.rb
53
+ - spec/spec_helper.rb
54
+ homepage: https://github.com/willywos/fumullins_formatter
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project: fumullins-formatter
74
+ rubygems_version: 1.8.16
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: fumullins RSpec formatter!
78
+ test_files:
79
+ - spec/fumullins_formatter_spec.rb
80
+ - spec/spec_helper.rb