dots_formatter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 177baa5ac05cd0edbcdeac6a34aa9675230341a8
4
+ data.tar.gz: 96fb7a42e60b36fe253ed134549299a6ba1a5251
5
+ SHA512:
6
+ metadata.gz: 77074a5278ba71c24ffb096375cdeb1470725626d9c084be981e76f32c6c183ba07df5d90e47e4aa6be6eecec0b018aec5112431ad71d10913b6371ad1b95d9b
7
+ data.tar.gz: 680816919dce56e65cf5d75f9b3963cf396788e1c76194b20d1b9908ad83ec3239e3e502a5574cfac04cb05071c32cb521c0fdfc18919b0fe7fe2b03b1e42db2
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --require dots_formatter/dots
4
+ --format DotsFormatter
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.2.5)
5
+ rspec (3.3.0)
6
+ rspec-core (~> 3.3.0)
7
+ rspec-expectations (~> 3.3.0)
8
+ rspec-mocks (~> 3.3.0)
9
+ rspec-core (3.3.1)
10
+ rspec-support (~> 3.3.0)
11
+ rspec-expectations (3.3.0)
12
+ diff-lcs (>= 1.2.0, < 2.0)
13
+ rspec-support (~> 3.3.0)
14
+ rspec-mocks (3.3.1)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.3.0)
17
+ rspec-support (3.3.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ rspec
24
+
25
+ BUNDLED WITH
26
+ 1.10.5
data/README.md CHANGED
@@ -18,11 +18,16 @@ with the time taken for each test.
18
18
 
19
19
  Currently only works with RSpec 3 and up.
20
20
 
21
- To run, clone the repo then in either a project specific .rspec file or
21
+
22
+ To run, first install the gem:
23
+ ```ruby
24
+ gem install dots_formatter
25
+ ```
26
+
27
+ then in either a project specific .rspec file or
22
28
  in your home .rspec file, or directly on the command line:
23
29
 
24
30
  ```ruby
25
- --require /path/to/dots_formatter/lib/dots_formmater.rb
26
31
  --format DotsFormatter
27
32
  ```
28
33
 
@@ -30,6 +35,5 @@ in your home .rspec file, or directly on the command line:
30
35
 
31
36
  * Port RSpec 3 to RSpec 2
32
37
  * Better Readme
33
- * Gem-ify
34
38
  * Debug as command line option
35
39
  * Tests
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'dots_formatter'
3
- s.version = '0.0.1'
4
- s.date = '2015-05-14'
3
+ s.version = '0.0.2'
4
+ s.date = '2015-07-07'
5
5
  s.summary = "A simple, informative RSpec formatter"
6
6
  s.description = "Get instance feedback on number of passed:failed:pending / total with quick failure status"
7
7
  s.authors = ["Paul Brennan"]
@@ -1,19 +1,18 @@
1
1
  # coding: utf-8
2
2
  RSpec::Support.require_rspec_core "formatters/base_text_formatter"
3
- module RSpec
3
+ module RSpec
4
4
  module Core
5
- module Formatters
5
+ module Formatters
6
6
 
7
7
  class Dots < BaseTextFormatter
8
8
 
9
9
  Formatters.register self, :example_passed, :example_pending, :example_started,
10
10
  :example_failed, :start, :dump_failures
11
-
12
11
  attr_accessor :passes, :fails, :runs, :pendings, :screen_width, :start_time, :example_start, :debug
13
12
 
14
13
  def initialize(output)
15
14
  @passes = 0
16
- @fails = 0
15
+ @fails = 0
17
16
  @runs = 0
18
17
  @pendings = 0
19
18
  @screen_width = `tput cols`.to_i - 1
@@ -43,11 +42,11 @@ module RSpec
43
42
  @passes += 1
44
43
  print_progress(example, true)
45
44
  end
46
-
45
+
47
46
  def example_failed(example)
48
47
  @fails += 1
49
48
  @runs += 1
50
- failure = ConsoleCodes.wrap("\r Failed example: ", :failure) +
49
+ failure = ConsoleCodes.wrap("\r Failed example: ", :failure) +
51
50
  ConsoleCodes.wrap(example.example.full_description, :white)
52
51
  output.puts failure[0..@screen_width].ljust(@screen_width) unless @debug
53
52
  print_progress(example, true)
@@ -57,7 +56,7 @@ module RSpec
57
56
  def dump_summary(summary)
58
57
  output.puts
59
58
  output.puts
60
- colour = (@fails == 0)? :success : :failure
59
+ colour = (@fails == 0)? :success : :failure
61
60
 
62
61
  output.puts ConsoleCodes.wrap("┌" + "-".ljust(50,"-") + "┐", colour)
63
62
  output.puts ConsoleCodes.wrap("│ #{summary.example_count} test#{summary.example_count == 1? '' : 's'}".ljust(50) + " |", colour)
@@ -65,12 +64,12 @@ module RSpec
65
64
  output.puts ConsoleCodes.wrap("| Ran in #{Helpers.format_duration summary.duration}".ljust(50) + " |", colour)
66
65
  output.puts ConsoleCodes.wrap("└" + "-".ljust(50,"-") + "┘", colour)
67
66
  output.puts
68
- output.puts summary.colorized_rerun_commands
67
+ output.puts summary.colorized_rerun_commands if @fails > 0
69
68
  end
70
69
 
71
70
  def dump_failures(notification)
72
71
  output.puts
73
- output.puts notification.fully_formatted_failed_examples
72
+ output.puts notification.fully_formatted_failed_examples if @fails > 0
74
73
  end
75
74
 
76
75
  def print_progress(example, finish = false)
@@ -78,7 +77,7 @@ module RSpec
78
77
  tot = ConsoleCodes.wrap("#{@example_count}", :white)
79
78
  fls = ConsoleCodes.wrap("#{fails}", :failure)
80
79
  suc = ConsoleCodes.wrap("#{@runs - @fails}", :success)
81
- png = ConsoleCodes.wrap("#{@pendings}", :pending)
80
+ png = ConsoleCodes.wrap("#{@pendings}", :pending)
82
81
  current_dur = Time.now - @start_time
83
82
  prev_dur = Time.now - @example_start
84
83
  tim = ConsoleCodes.wrap( "(Running #{Helpers.format_duration current_dur})", :cyan)
@@ -1,10 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  if Gem::Version.new(RSpec::Core::Version::STRING).release >= Gem::Version.new('3.0.0')
4
- require_relative './dots_formatter/dots_formatter_rspec_3'
4
+ require_relative './dots_formatter/dots'
5
5
  DotsFormatter = RSpec::Core::Formatters::Dots
6
- else
7
- require_relative './dots_formmater/dots_formatter_rspec_2'
8
- DotsFormatter = Rspec2
9
6
  end
10
7
 
@@ -0,0 +1,28 @@
1
+ class TestOutput
2
+
3
+ attr_accessor :messages
4
+
5
+ def initialize
6
+ @messages = []
7
+ end
8
+
9
+ def puts(message)
10
+ @messages << message
11
+ end
12
+ end
13
+
14
+ describe 'dots formatter' do
15
+
16
+ let(:output){TestOutput.new}
17
+ let(:formatter){DotsFormatter.new(output)}
18
+
19
+ it 'should set the default values' do
20
+ expect(formatter.fails).to eq(0)
21
+ expect(formatter.passes).to eq(0)
22
+ expect(formatter.fails).to eq(0)
23
+ expect(formatter.runs).to eq(0)
24
+ expect(formatter.pendings).to eq(0)
25
+ expect(formatter.debug).to eq(false)
26
+ end
27
+
28
+ end
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |expectations|
3
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
4
+ end
5
+
6
+ config.mock_with :rspec do |mocks|
7
+ mocks.verify_partial_doubles = true
8
+ end
9
+
10
+ config.filter_run :focus
11
+ config.run_all_when_everything_filtered = true
12
+
13
+
14
+ # This setting enables warnings. It's recommended, but in some cases may
15
+ # be too noisy due to issues in dependencies.
16
+ config.warnings = true
17
+
18
+ config.order = :random
19
+
20
+ Kernel.srand config.seed
21
+ end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dots_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Paul Brennan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Get instance feedback on number of passed:failed:pending / total with
15
14
  quick failure status
@@ -18,36 +17,40 @@ executables: []
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - Gemfile
23
+ - Gemfile.lock
21
24
  - README.md
22
25
  - docs/all_passing.jpg
23
26
  - docs/with_failure.jpg
24
27
  - dots_formatter.gemspec
25
28
  - lib/dots_formatter.rb
26
- - lib/dots_formatter/dots_formatter_rspec_2.rb
27
- - lib/dots_formatter/dots_formatter_rspec_3.rb
29
+ - lib/dots_formatter/dots.rb
30
+ - spec/dots_formatter/dots_spec.rb
31
+ - spec/spec_helper.rb
28
32
  homepage: https://github.com/yule/dots_formatter
29
33
  licenses:
30
34
  - MIT
35
+ metadata: {}
31
36
  post_install_message:
32
37
  rdoc_options: []
33
38
  require_paths:
34
39
  - lib
35
40
  required_ruby_version: !ruby/object:Gem::Requirement
36
- none: false
37
41
  requirements:
38
- - - ! '>='
42
+ - - ">="
39
43
  - !ruby/object:Gem::Version
40
44
  version: '0'
41
45
  required_rubygems_version: !ruby/object:Gem::Requirement
42
- none: false
43
46
  requirements:
44
- - - ! '>='
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '0'
47
50
  requirements: []
48
51
  rubyforge_project:
49
- rubygems_version: 1.8.24
52
+ rubygems_version: 2.4.8
50
53
  signing_key:
51
- specification_version: 3
54
+ specification_version: 4
52
55
  summary: A simple, informative RSpec formatter
53
56
  test_files: []
@@ -1,60 +0,0 @@
1
- # coding: utf-8
2
- require 'rspec/core/formatters/progress_formatter'
3
- class Rspec2 < RSpec::Core::Formatters::BaseTextFormatter
4
-
5
- def start(number)
6
- super(number)
7
- output.puts
8
- end
9
-
10
- def example_started(example)
11
- super(example)
12
- print_progress(example)
13
- end
14
-
15
- def example_passed(example)
16
- super(example)
17
- #print_progress
18
- end
19
-
20
- def example_failed(example)
21
- super(example)
22
- @failure_count += 1
23
- print_progress(example)
24
- end
25
-
26
-
27
- def dump_summary(duration, example_count, failure_count, pending_count)
28
- output.puts
29
- output.puts
30
- output.puts "Finished in #{format_duration duration}"
31
- output.puts
32
- if failure_count == 0
33
- output.puts success_color("┌" + "--------------" + "-".ljust(20,"-") + "┐")
34
- output.puts success_color("│" + " (^ヽ--△<^)" + " ".ljust(20) + "│")
35
- output.puts success_color("│" + " /     ~▽" + " ".ljust(20) + "│")
36
- output.puts success_color("│" + "士 0 o 0 士" + " #{example_count} test#{example_count > 1? 's' : ' '}".ljust(20) + "│")
37
- output.puts success_color("│" + " メ ___ メ " + " ".ljust(20) + "│")
38
- output.puts success_color("│" + "  / へ`-L、 " + " No failures.".ljust(20) + "│")
39
- output.puts success_color("│" + " (~( し′| )" + " ".ljust(20) + "│")
40
- output.puts success_color("└" + "--------------" + "-".ljust(20,"-") + "┘")
41
- else
42
- output.puts failure_color("┌" + "-".ljust(50,"-") + "┐")
43
- output.puts failure_color("│ #{example_count} test#{example_count > 1? 's' : ' '}, #{failure_count} failure#{failure_count > 1? 's' : ' '}".ljust(50) + " │")
44
- output.puts failure_color("└" + "-".ljust(50,"-") + "┘")
45
- super
46
- end
47
- end
48
-
49
- def print_progress(example)
50
- if @failure_count > 0
51
- output.print failure_color("\r ● #{@examples.count - @failure_count}/#{@example_count}. #{@pending_count + '. pending.' if @pending_count > 0} #{example.full_description.ljust(150)}")
52
- elsif @pending_count > 0
53
- output.print pending_color("\r ● #{@examples.count - @failure_count}/#{@example_count}. #{@pending_count} pending #{example.full_description.ljust(150)}")
54
- else
55
- output.print success_color("\r ● #{@examples.count - @failure_count}/#{@example_count} #{example.full_description.ljust(150)}\r")
56
- end
57
-
58
- end
59
-
60
- end