stopwatch_formatter 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f6b0b05ce7915b5a8d885fe888ce0d9a2125bd8
4
+ data.tar.gz: 2fe2abaf71a2e50be6497d8706ad376ba9083475
5
+ SHA512:
6
+ metadata.gz: 062f8dc66f047b031ec544b0917c07e923896671593602c07dd765609099a1a66c64cc2956edec67bce4e14866792958be56fd54515d52be07e13d2874e41a91
7
+ data.tar.gz: 938244bc53fd60011e50c10ff06704810911d1ee86f8c13137d7587bf963c89718e97548297654dbb36df48172deb58bc871ed5e376fb31fd729e9f8075c45c5
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format StopwatchFormatter
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec_stopwatch_formatter.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tamara Temple
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # StopwatchFormatter
2
+
3
+ Add test duration for each test in the Documentation format.
4
+
5
+ (Based on https://github.com/mariuszlusiak/RSpec-custom-formatter)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'stopwatch_formatter'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install stopwatch_formatter
20
+
21
+ ## Usage
22
+
23
+ Add the following to your `spec/spec_helper.rb` file:
24
+
25
+ require 'stopwatch_formatter'
26
+
27
+ Add or change the following in your `.rspec` file:
28
+
29
+ --format StopwatchFormatter
30
+
31
+ Alternatively, you can add the following to the `spec/spec_helper.rb`
32
+ file:
33
+
34
+ RSpec.configure {|c| c.add_formatter StopwatchFormatter }
35
+
36
+ but if you also specify a formatter via the command line or .rspec,
37
+ you'll get both sets of output (fun!).
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,15 @@
1
+ require 'rspec/core/formatters/documentation_formatter'
2
+
3
+ class StopwatchFormatter < RSpec::Core::Formatters::DocumentationFormatter
4
+
5
+ DURATION_FORMAT = "%-80s | Duration: %7.5f ms"
6
+
7
+ def failure_output(example, exception)
8
+ failure_color(DURATION_FORMAT % ["#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})", example.execution_result[:run_time]])
9
+ end
10
+
11
+ def passed_output(example)
12
+ success_color(DURATION_FORMAT % ["#{current_indentation}#{example.description.strip}", example.execution_result[:run_time]])
13
+ end
14
+
15
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe StopwatchFormatter do
4
+ it 'this will pass' do
5
+ true.should be_true
6
+ end
7
+ it 'this will fail' do
8
+ false.should be_true
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ #$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'stopwatch_formatter'
3
+ # Adding this formatter here makes it a 'permanent' formatter and
4
+ # other formatters specified by --format (on the command line or in
5
+ # .rspec will show as well) -- not recommended, really
6
+ # RSpec.configure {|c| c.add_formatter StopwatchFormatter }
7
+
8
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "stopwatch_formatter"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Tamara Temple"]
9
+ spec.email = ["tamouse@gmail.com"]
10
+ spec.description = %q{The standard RSpec documentation formatter does not display the amount of time each test took. This formatter provides that information}
11
+ spec.summary = %q{Show test duration in output}
12
+ spec.homepage = "http://github.com/tamouse/rspec_stopwatch_formatter"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rspec"
23
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stopwatch_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Tamara Temple
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: The standard RSpec documentation formatter does not display the amount
56
+ of time each test took. This formatter provides that information
57
+ email:
58
+ - tamouse@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .rspec
65
+ - .travis.yml
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/stopwatch_formatter.rb
71
+ - spec/lib/stopwatch_formatter_spec.rb
72
+ - spec/spec_helper.rb
73
+ - stopwatch_formatter.gemspec
74
+ homepage: http://github.com/tamouse/rspec_stopwatch_formatter
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Show test duration in output
98
+ test_files:
99
+ - spec/lib/stopwatch_formatter_spec.rb
100
+ - spec/spec_helper.rb