mrspec 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/.rspec +0 -3
- data/bin/mrspec +2 -0
- data/lib/mrspec/{option_parser.rb → add_options_to_rspec_parser.rb} +9 -3
- data/lib/mrspec/configuration.rb +12 -1
- data/lib/mrspec/version.rb +1 -1
- data/lib/mrspec.rb +1 -1
- data/mrspec.gemspec +1 -1
- data/test/test_formatter_configuration.rb +39 -0
- data/test/test_parser_monkey_patches.rb +18 -0
- metadata +19 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f780aa00ec439a3a02949504abde99cf6fcf6a
|
4
|
+
data.tar.gz: 587d8a5cdb8d00d0cf43116277bd46267a41a0c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca564c0d264259457e0b35417aacd89e7382fa2e3e0ec508068634312cf87e89213a2a0aa9311eb00667bccb4f55ad1414402271a0371164e23359497787d1bd
|
7
|
+
data.tar.gz: 4bc61ec3937446e6a0bf1b2ee6a57604f831acd457b8cb85d494ea2febd61427ff59a7fb73f8214e5f679e4d65ba4326a68d53215886bf41a76dce2e4c02192f
|
data/.rspec
CHANGED
data/bin/mrspec
CHANGED
@@ -22,12 +22,18 @@ class RSpec::Core::Parser
|
|
22
22
|
# calling exit and toplevel puts, b/c that's what RSpec's does https://github.com/rspec/rspec-core/blob/c7c1154934c42b5f6905bb7bd22025fe6c8a816c/lib/rspec/core/option_parser.rb#L290
|
23
23
|
# and I don't feel like figuring out how to work around it.
|
24
24
|
option_parser.on('-v', '--version', 'Display the version.') do
|
25
|
-
puts "mrspec #{MRspec::VERSION}\n"\
|
26
|
-
|
27
|
-
|
25
|
+
$stdout.puts "mrspec #{MRspec::VERSION}\n"\
|
26
|
+
"rspec-core #{RSpec::Core::Version::STRING}\n"\
|
27
|
+
"minitest #{Minitest::VERSION}\n"
|
28
28
|
exit
|
29
29
|
end
|
30
30
|
|
31
|
+
format_description = option_parser.top.short['f'].desc
|
32
|
+
first_option = format_description.find { |s| s[/\[[a-zA-Z]\]/] }
|
33
|
+
leading_whitespace = first_option[/^\s*/]
|
34
|
+
index = format_description.index first_option
|
35
|
+
format_description.insert index, "#{leading_whitespace}[w]hat (we've got here is an error to communicate)"
|
36
|
+
|
31
37
|
option_parser
|
32
38
|
end
|
33
39
|
|
data/lib/mrspec/configuration.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
require 'mrspec/declare_minitests'
|
2
1
|
require 'rspec/core'
|
2
|
+
require 'mrspec/declare_minitests'
|
3
|
+
require 'error_to_communicate/rspec_formatter'
|
3
4
|
|
4
5
|
module MRspec
|
5
6
|
class Configuration < RSpec::Core::Configuration
|
@@ -8,11 +9,21 @@ module MRspec
|
|
8
9
|
disable_monkey_patching!
|
9
10
|
filter_gems_from_backtrace 'mrspec', 'minitest'
|
10
11
|
self.pattern = pattern.sub '*_spec.rb', '{*_spec,*_test,test_*}.rb'
|
12
|
+
self.default_formatter = WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
|
11
13
|
end
|
12
14
|
|
13
15
|
def load_spec_files(*)
|
14
16
|
super
|
15
17
|
MRspec::DeclareMinitests.call(RSpec, Minitest, Minitest::Runnable.runnables)
|
16
18
|
end
|
19
|
+
|
20
|
+
def add_formatter(*args)
|
21
|
+
if args.any? { |formatter| formatter == 'w' || formatter =~ /^what/ }
|
22
|
+
super WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
|
23
|
+
else
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
17
28
|
end
|
18
29
|
end
|
data/lib/mrspec/version.rb
CHANGED
data/lib/mrspec.rb
CHANGED
data/mrspec.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency "rspec-core", "~> 3.0"
|
20
20
|
s.add_dependency "minitest", "~> 5.0"
|
21
|
+
s.add_dependency "what_weve_got_here_is_an_error_to_communicate", "~> 0.0.3"
|
21
22
|
|
22
23
|
s.add_development_dependency "haiti", ">= 0.2.2", "< 0.3"
|
23
24
|
s.add_development_dependency "cucumber", "~> 2.0"
|
24
|
-
s.add_development_dependency "what_weve_got_here_is_an_error_to_communicate", "> 0"
|
25
25
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'support/helper'
|
2
|
+
|
3
|
+
class TestFormatterConfiguration < Minitest::Spec
|
4
|
+
def formatters_are!(*formatters, &block)
|
5
|
+
config = MRspec::Configuration.new
|
6
|
+
block.call config
|
7
|
+
assert_equal formatters, config.formatters.map(&:class)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'defaults to WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter' do
|
11
|
+
refute_equal RSpec::Core::Configuration.new.default_formatter,
|
12
|
+
WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
|
13
|
+
|
14
|
+
assert_equal MRspec::Configuration.new.default_formatter,
|
15
|
+
WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
it 'doesn\'t fuck up the normal formatter selection' do
|
20
|
+
formatters_are! RSpec::Core::Formatters::ProgressFormatter do |config|
|
21
|
+
config.add_formatter 'p'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
it 'can be specified with "--format w" and "--format what<anything>"' do
|
27
|
+
formatters_are! WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter do |config|
|
28
|
+
config.add_formatter 'what'
|
29
|
+
end
|
30
|
+
|
31
|
+
formatters_are! WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter do |config|
|
32
|
+
config.add_formatter 'whatever'
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_raises ArgumentError, /\bwha\b/ do
|
36
|
+
MRspec::Configuration.new.add_formatter 'wha'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -70,6 +70,24 @@ class TestParserMonkeyPatches < Minitest::Spec
|
|
70
70
|
# Giving up on making sure these are equivalent, it's not the end of the world if they aren't
|
71
71
|
# I'm basically at a point where I think that no one should use OptionParser
|
72
72
|
it 'sets the correct description for the versions'
|
73
|
+
|
74
|
+
it 'includes the what_weve_got_here_is_an_error_to_communicate formatter in the help screen' do
|
75
|
+
parser = Parser.new.mrspec_parser({})
|
76
|
+
help = record_hostile_parsing parser, '--help'
|
77
|
+
formatters = help.lines
|
78
|
+
.drop_while { |l| l !~ /--format/ }
|
79
|
+
.drop(1)
|
80
|
+
.take_while { |l| l =~ /^\s*\[/ }
|
81
|
+
refute_empty formatters
|
82
|
+
indentation, initials = formatters.map { |formatter_line|
|
83
|
+
[formatter_line[/^\s*/].length,
|
84
|
+
formatter_line[/\[.\]/]
|
85
|
+
]
|
86
|
+
}.transpose
|
87
|
+
first_indentation = indentation.first
|
88
|
+
indentation.each { |i| assert_equal first_indentation, i }
|
89
|
+
assert_equal '[w]', initials.first
|
90
|
+
end
|
73
91
|
end
|
74
92
|
|
75
93
|
it 'stores the current parser in .parser_method' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Cheek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: what_weve_got_here_is_an_error_to_communicate
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.3
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: haiti
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,20 +86,6 @@ dependencies:
|
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '2.0'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: what_weve_got_here_is_an_error_to_communicate
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
89
|
description: 'Allows you to run Minitest tests and specs with RSpec''s runner, thus
|
90
90
|
you can write both Minitest and RSpec, side-by-side, and take advantage of the many
|
91
91
|
incredibly helpful features it supports (primarily: better formatters, --colour,
|
@@ -106,17 +106,18 @@ files:
|
|
106
106
|
- features/mrspec.feature
|
107
107
|
- features/support/env.rb
|
108
108
|
- lib/mrspec.rb
|
109
|
+
- lib/mrspec/add_options_to_rspec_parser.rb
|
109
110
|
- lib/mrspec/configuration.rb
|
110
111
|
- lib/mrspec/declare_minitests.rb
|
111
112
|
- lib/mrspec/fix_backtraces_on_minitest_spec.rb
|
112
113
|
- lib/mrspec/minitest_assertion_for_rspec.rb
|
113
114
|
- lib/mrspec/minitest_metadata.rb
|
114
|
-
- lib/mrspec/option_parser.rb
|
115
115
|
- lib/mrspec/runner.rb
|
116
116
|
- lib/mrspec/version.rb
|
117
117
|
- mrspec.gemspec
|
118
118
|
- test/support/helper.rb
|
119
119
|
- test/support/mock.rb
|
120
|
+
- test/test_formatter_configuration.rb
|
120
121
|
- test/test_mrspec.rb
|
121
122
|
- test/test_parser_monkey_patches.rb
|
122
123
|
homepage: https://github.com/JoshCheek/mrspec
|
@@ -148,6 +149,7 @@ test_files:
|
|
148
149
|
- features/support/env.rb
|
149
150
|
- test/support/helper.rb
|
150
151
|
- test/support/mock.rb
|
152
|
+
- test/test_formatter_configuration.rb
|
151
153
|
- test/test_mrspec.rb
|
152
154
|
- test/test_parser_monkey_patches.rb
|
153
155
|
has_rdoc:
|