spec_cat 3.0.0 → 3.1.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/README.md +29 -10
- data/Rakefile +1 -1
- data/lib/spec_cat/matchers/eql_file.rb +0 -1
- data/lib/spec_cat/matchers/have_a_spec.rb +2 -3
- data/lib/spec_cat/matchers/include_module.rb +2 -2
- data/lib/spec_cat/matchers/pass_rubocop.rb +23 -0
- data/lib/spec_cat/railtie.rb +1 -1
- data/lib/spec_cat/version.rb +1 -1
- data/lib/spec_cat.rb +4 -4
- data/lib/tasks/spec_cat.rake +1 -2
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b84fd1f4e2097a04f97999494e33dae7847831d
|
4
|
+
data.tar.gz: d8e88413705f10314da4efd35b2c8dbd431728df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3d6b2a1ce6dd8ad560e56dff483734addc3e16372b0cc1b4d325798b2faf11400d875c514b7892ebb5a117863924692e430fb903f8157f13ddc00f2473b074
|
7
|
+
data.tar.gz: 2273da168b1853be5aebe98f1497607674f91e143de27a6516bcdfbd7ffcad5c3989e1e339893db6836e590f043e0814c9032caa849df811e9cefe2c41dfd658
|
data/README.md
CHANGED
@@ -11,6 +11,7 @@ This gem contains trivial matchers to make RSpecs a bit more effective and less
|
|
11
11
|
* eql_file
|
12
12
|
* have_a_spec
|
13
13
|
* include_module
|
14
|
+
* pass_rubocop
|
14
15
|
|
15
16
|
It also provides rake commands
|
16
17
|
|
@@ -24,7 +25,20 @@ It also provides rake commands
|
|
24
25
|
|
25
26
|
Add this to your gemfile...
|
26
27
|
|
27
|
-
|
28
|
+
gem 'spec_cat'
|
29
|
+
gem 'simplecov', :require => false
|
30
|
+
|
31
|
+
Add this to your spec_helper.rb...
|
32
|
+
|
33
|
+
# Initialize SimpleCov
|
34
|
+
|
35
|
+
require 'simplecov'
|
36
|
+
|
37
|
+
SimpleCov.start 'rails' do
|
38
|
+
add_filter '/vendor/'
|
39
|
+
add_filter '/spec/'
|
40
|
+
end
|
41
|
+
|
28
42
|
|
29
43
|
## Matchers
|
30
44
|
|
@@ -37,7 +51,7 @@ It also writes a .tmp file to replace the old ground truth if it's gone stale.
|
|
37
51
|
|
38
52
|
e.g. #foo produces a gnarly string too nasty to copy and paste into spec code.
|
39
53
|
|
40
|
-
foo.
|
54
|
+
expect( foo ).to eql_file( 'spec/data/foo.json' )
|
41
55
|
|
42
56
|
... if it fails for a valid change, you can just....
|
43
57
|
|
@@ -54,7 +68,7 @@ If you use this, you should add `*.tmp` to your .gitignore.
|
|
54
68
|
`have_a_spec` will ensure that any given path has a corresponding spec file to
|
55
69
|
help ensure that you have good coverage.
|
56
70
|
|
57
|
-
'app/controllers/application_controller.rb'.
|
71
|
+
expect( 'app/controllers/application_controller.rb' ).to have_a_spec
|
58
72
|
|
59
73
|
... is a good thing to write right after you integrate RSpec.
|
60
74
|
|
@@ -66,7 +80,14 @@ Here's an example coverage spec...
|
|
66
80
|
|
67
81
|
`include_module` makes it easy to spec concern inclusion.
|
68
82
|
|
69
|
-
it( 'is Taggable' ) {
|
83
|
+
it( 'is Taggable' ) { is_expected.to include_module( Taggable ) }
|
84
|
+
|
85
|
+
### pass_rubocop
|
86
|
+
|
87
|
+
`pass_rubcop` just executes [Rubocop](http://batsov.com/rubocop/) and passes or fails
|
88
|
+
based on it's exit status.
|
89
|
+
|
90
|
+
it( 'passes' ) { is_expected.to pass_rubocop }
|
70
91
|
|
71
92
|
## Rake Tasks
|
72
93
|
|
@@ -86,20 +107,18 @@ specs pass.
|
|
86
107
|
## Reference
|
87
108
|
|
88
109
|
* [RSpec](https://github.com/rspec/rspec)
|
110
|
+
* [Rubocop](http://batsov.com/rubocop/)
|
111
|
+
* [Better Specs](http://betterspecs.org)
|
112
|
+
* [Publishing your gem](http://guides.rubygems.org/publishing/)
|
89
113
|
* [Testing Rake Tasks with RSpec](http://www.philsergi.com/2009/02/testing-rake-tasks-with-rspec.html)
|
90
114
|
* [Nathan Humbert's Blog: Rails 3: Loading rake tasks from a gem](http://blog.nathanhumbert.com/2010/02/rails-3-loading-rake-tasks-from-gem.html)
|
91
115
|
* [Add Achievement Badges to Your Gem README](http://elgalu.github.io/2013/add-achievement-badges-to-your-gem-readme/)
|
92
|
-
* [Publishing your gem](http://guides.rubygems.org/publishing/)
|
93
|
-
* [Better Specs](http://betterspecs.org)
|
94
116
|
|
95
117
|
## Version History
|
96
118
|
|
119
|
+
* 3.1.0 - Rubocop integration
|
97
120
|
* 3.0.0 - RSpec 3 supported
|
98
121
|
* 1.0.3 - Last version with RSpec 2.x support
|
99
122
|
|
100
|
-
## TODO
|
101
|
-
|
102
|
-
* Fix include_module - only get class if arg is not already a class
|
103
|
-
* Add more matchers
|
104
123
|
|
105
124
|
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ RSpec::Matchers.define :have_a_spec do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
match do |path|
|
12
|
-
File.
|
12
|
+
File.exist?( spec_file_for( path ) )
|
13
13
|
end
|
14
14
|
|
15
15
|
failure_message do |path|
|
@@ -29,5 +29,4 @@ RSpec::Matchers.define :have_a_spec do
|
|
29
29
|
|
30
30
|
return File.join( dirname, basename )
|
31
31
|
end
|
32
|
-
|
33
|
-
end
|
32
|
+
end
|
@@ -17,7 +17,7 @@ RSpec::Matchers.define :include_module do |expected_module|
|
|
17
17
|
end
|
18
18
|
|
19
19
|
match do |subject|
|
20
|
-
subject.
|
20
|
+
target = subject.is_a?( Class ) ? subject : subject.class
|
21
|
+
target.included_modules.include?( expected_module )
|
21
22
|
end
|
22
|
-
|
23
23
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# pass_rubocop.rb
|
2
|
+
#
|
3
|
+
# Confirms that the working directory passes rubocop
|
4
|
+
|
5
|
+
RSpec::Matchers.define :pass_rubocop do
|
6
|
+
|
7
|
+
description do
|
8
|
+
'passes rubocop'
|
9
|
+
end
|
10
|
+
|
11
|
+
failure_message do
|
12
|
+
report = `rubocop`
|
13
|
+
"expected that rubocop would pass\n\n#{report}"
|
14
|
+
end
|
15
|
+
|
16
|
+
failure_message_when_negated do
|
17
|
+
'expected that rubocop would not pass'
|
18
|
+
end
|
19
|
+
|
20
|
+
match do
|
21
|
+
Kernel.system( 'rubocop > /dev/null' )
|
22
|
+
end
|
23
|
+
end
|
data/lib/spec_cat/railtie.rb
CHANGED
data/lib/spec_cat/version.rb
CHANGED
data/lib/spec_cat.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rspec'
|
|
3
3
|
require 'spec_cat/matchers/eql_file'
|
4
4
|
require 'spec_cat/matchers/have_a_spec'
|
5
5
|
require 'spec_cat/matchers/include_module'
|
6
|
+
require 'spec_cat/matchers/pass_rubocop'
|
6
7
|
|
7
8
|
require 'spec_cat/railtie' if defined?(Rails)
|
8
9
|
|
@@ -13,11 +14,10 @@ module SpecCat
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.write( path, content )
|
16
|
-
File.open( path,'wb' ) { |io| io.write content }
|
17
|
+
File.open( path, 'wb' ) { |io| io.write content }
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.read( path )
|
20
|
-
File.open( path, 'rb'
|
21
|
+
File.open( path, 'rb', &:read )
|
21
22
|
end
|
22
|
-
|
23
|
-
end
|
23
|
+
end
|
data/lib/tasks/spec_cat.rake
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
namespace :
|
1
|
+
namespace :spec_cat do
|
2
2
|
|
3
3
|
desc 'Run rspec and accept all ground truth file changes'
|
4
4
|
task :accept do
|
@@ -10,5 +10,4 @@ namespace :'spec_cat' do
|
|
10
10
|
task :coverage do
|
11
11
|
Kernel.system 'rspec spec && open coverage/index.html'
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec_cat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Humphrey
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 3.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubocop
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: rails
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +117,7 @@ files:
|
|
103
117
|
- lib/spec_cat/matchers/eql_file.rb
|
104
118
|
- lib/spec_cat/matchers/have_a_spec.rb
|
105
119
|
- lib/spec_cat/matchers/include_module.rb
|
120
|
+
- lib/spec_cat/matchers/pass_rubocop.rb
|
106
121
|
- lib/spec_cat/railtie.rb
|
107
122
|
- lib/spec_cat/version.rb
|
108
123
|
- lib/tasks/spec_cat.rake
|
@@ -113,7 +128,7 @@ metadata: {}
|
|
113
128
|
post_install_message:
|
114
129
|
rdoc_options: []
|
115
130
|
require_paths:
|
116
|
-
-
|
131
|
+
- lib
|
117
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
133
|
requirements:
|
119
134
|
- - ">="
|
@@ -126,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
141
|
version: '0'
|
127
142
|
requirements: []
|
128
143
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.6.11
|
130
145
|
signing_key:
|
131
146
|
specification_version: 4
|
132
147
|
summary: RSpec support library
|