should_not 1.0.0 → 1.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 +7 -0
- data/README.md +6 -0
- data/Rakefile +1 -1
- data/integration/rspec.rb +5 -5
- data/lib/should_not/minitest.rb +1 -1
- data/lib/should_not/rspec.rb +1 -1
- data/lib/should_not/version.rb +1 -1
- data/should_not.gemspec +2 -2
- data/spec/should_not_spec.rb +11 -10
- metadata +29 -42
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6846b4e1df6ccd2955b9af174dca2d88b036adb2
|
4
|
+
data.tar.gz: 885ed9c210f81cf5ab19bb87f26916ed01e7cec5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31735bf17edcb99430701882b001b384a235623ca09a7ac6d0c24cbb8be83cd3410e43560bc12ad5da14ad99b222b972071908cfbfc46a1a4900b63f93a6a47e
|
7
|
+
data.tar.gz: 6b2e23108db276a38219c74217f564feca3818535af476a538ae5c8fcfa3ec064e566efbcab4e0d77d00f8e06886ca1893de294e5fb724820d4163a9e0fdadbc
|
data/README.md
CHANGED
@@ -48,6 +48,12 @@ Once it's ready, I'll be happy to add your port as a repo under the [`should-not
|
|
48
48
|
If you'd like to contribute to the Ruby version `should_not`, we could use support for more testing frameworks.
|
49
49
|
Just make sure that you have integration test coverage before you open a pull request.
|
50
50
|
|
51
|
+
## Related Projects
|
52
|
+
|
53
|
+
* The [should_clean gem](https://github.com/siyelo/should_clean) from @siyelo is a utility that changes `'it "should do something"'` to `'it "does something"'`
|
54
|
+
* [BetterSpecs](http://betterspecs.org/#should) currently recommends not beginning your specs with "should."
|
55
|
+
There is good discussion about this topic at their [GitHub issue](https://github.com/andreareginato/betterspecs/issues/15) about not starting with "should."
|
56
|
+
|
51
57
|
## License
|
52
58
|
|
53
59
|
Available under the terms of the MIT license.
|
data/Rakefile
CHANGED
@@ -23,7 +23,7 @@ task :minitest do
|
|
23
23
|
ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
24
24
|
output = `#{ruby} #{integration_file('minitest')}`
|
25
25
|
|
26
|
-
assert_contains!(output, '6
|
26
|
+
assert_contains!(output, '6 runs')
|
27
27
|
assert_contains!(output, '2 failures')
|
28
28
|
puts "MiniTest integration spec passed"
|
29
29
|
end
|
data/integration/rspec.rb
CHANGED
@@ -2,24 +2,24 @@ require 'should_not/rspec'
|
|
2
2
|
|
3
3
|
describe RSpec do
|
4
4
|
it 'should fail when the string starts with should' do
|
5
|
-
1.
|
5
|
+
expect(1).to eq(1)
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'can pass a normal test' do
|
9
|
-
1.
|
9
|
+
expect(1).to eq(1)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'does not mind if "should" is in the middle of a string' do
|
13
|
-
1.
|
13
|
+
expect(1).to eq(1)
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'a nested context' do
|
17
17
|
it 'should also fail when the string starts with should' do
|
18
|
-
1.
|
18
|
+
expect(1).to eq(1)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'can also pass a normal test' do
|
22
|
-
1.
|
22
|
+
expect(1).to eq(1)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/should_not/minitest.rb
CHANGED
@@ -2,6 +2,6 @@ require 'minitest/spec'
|
|
2
2
|
require 'should_not/constants'
|
3
3
|
|
4
4
|
MiniTest::Spec.before do |spec|
|
5
|
-
name = spec.
|
5
|
+
name = spec.name.to_s.gsub(ShouldNot::MINITEST_DESCRIPTION_PREFIX, '')
|
6
6
|
flunk(ShouldNot::FAILURE_MESSAGE) if name.match(ShouldNot::STARTS_WITH_SHOULD)
|
7
7
|
end
|
data/lib/should_not/rspec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rspec/core'
|
|
2
2
|
require 'should_not/constants'
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.before(:each) do
|
5
|
+
config.before(:each) do |example|
|
6
6
|
# Not sure that last is correct here -- is the array ever larger than one element?
|
7
7
|
description = example.metadata[:description_args].last.to_s
|
8
8
|
fail(ShouldNot::FAILURE_MESSAGE) if description.match(ShouldNot::STARTS_WITH_SHOULD)
|
data/lib/should_not/version.rb
CHANGED
data/should_not.gemspec
CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
29
|
spec.add_development_dependency "rake"
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
31
|
+
spec.add_development_dependency "rspec", '~> 3.0'
|
32
32
|
end
|
data/spec/should_not_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'should_not/rspec'
|
|
4
4
|
|
5
5
|
describe ShouldNot do
|
6
6
|
it 'has a version number' do
|
7
|
-
ShouldNot::VERSION.
|
7
|
+
expect(ShouldNot::VERSION).to_not be_nil
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'constants' do
|
@@ -12,41 +12,42 @@ describe ShouldNot do
|
|
12
12
|
subject { ShouldNot::STARTS_WITH_SHOULD }
|
13
13
|
|
14
14
|
it 'matches the whole word "should" at the beginning of the string' do
|
15
|
-
'should foo bar'.
|
15
|
+
expect('should foo bar').to match(subject)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'matches when "should" is capitalized' do
|
19
|
-
'Should foo bar'.
|
19
|
+
expect('Should foo bar').to match(subject)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'does not match the word "should" in the middle of a string' do
|
23
|
-
'foo should bar'.
|
23
|
+
expect('foo should bar').to_not match(subject)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "matches shouldn't at the beggining" do
|
27
|
-
"shouldn't foo bar".
|
27
|
+
expect("shouldn't foo bar").to match(subject)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "does not match shouldn't in the middle" do
|
31
|
-
"foo shouldn't bar".
|
31
|
+
expect("foo shouldn't bar").to_not match(subject)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'does not other words starting with should' do
|
35
|
-
'shoulders are nice to have'.
|
36
|
-
'shoulda is a helpful library for testing Rails'.
|
35
|
+
expect('shoulders are nice to have').to_not match(subject)
|
36
|
+
expect('shoulda is a helpful library for testing Rails').to_not match(subject)
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
39
40
|
describe 'MINITEST_DESCRIPTION_PREFIX' do
|
40
41
|
subject { ShouldNot::MINITEST_DESCRIPTION_PREFIX }
|
41
42
|
|
42
43
|
it 'matches the irrelevant part of the test method name' do
|
43
44
|
stripped = 'test_0000_foo bar'.gsub(subject, '')
|
44
|
-
stripped.
|
45
|
+
expect(stripped).to eq('foo bar')
|
45
46
|
end
|
46
47
|
|
47
48
|
it 'handles when there are more than 10k tests' do
|
48
49
|
stripped = 'test_12345_foo bar'.gsub(subject, '')
|
49
|
-
stripped.
|
50
|
+
expect(stripped).to eq('foo bar')
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
metadata
CHANGED
@@ -1,93 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: should_not
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mark Rushakoff
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: minitest
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
47
|
+
version: '5.0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
54
|
+
version: '5.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
61
|
+
version: '3.0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
description:
|
79
|
-
|
80
|
-
|
81
|
-
|
68
|
+
version: '3.0'
|
69
|
+
description: |2
|
70
|
+
You should_not start your specs with the string "should".
|
71
|
+
If every spec starts with "should", then it's redundant everywhere.
|
72
|
+
|
73
|
+
Instead, write in an active tone:
|
74
|
+
`it "should ignore nil elements"` - BAD
|
75
|
+
`it "ignores nil elements"` - GOOD
|
82
76
|
email:
|
83
77
|
- mark.rushakoff@gmail.com
|
84
78
|
executables: []
|
85
79
|
extensions: []
|
86
80
|
extra_rdoc_files: []
|
87
81
|
files:
|
88
|
-
- .gitignore
|
89
|
-
- .rspec
|
90
|
-
- .travis.yml
|
82
|
+
- ".gitignore"
|
83
|
+
- ".rspec"
|
84
|
+
- ".travis.yml"
|
91
85
|
- Gemfile
|
92
86
|
- LICENSE.MIT
|
93
87
|
- README.md
|
@@ -105,33 +99,26 @@ files:
|
|
105
99
|
homepage: https://github.com/should-not/should_not
|
106
100
|
licenses:
|
107
101
|
- MIT
|
102
|
+
metadata: {}
|
108
103
|
post_install_message:
|
109
104
|
rdoc_options: []
|
110
105
|
require_paths:
|
111
106
|
- lib
|
112
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
108
|
requirements:
|
115
|
-
- -
|
109
|
+
- - ">="
|
116
110
|
- !ruby/object:Gem::Version
|
117
111
|
version: '0'
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
hash: 3309651739423284020
|
121
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
113
|
requirements:
|
124
|
-
- -
|
114
|
+
- - ">="
|
125
115
|
- !ruby/object:Gem::Version
|
126
116
|
version: '0'
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
hash: 3309651739423284020
|
130
117
|
requirements: []
|
131
118
|
rubyforge_project:
|
132
|
-
rubygems_version:
|
119
|
+
rubygems_version: 2.2.2
|
133
120
|
signing_key:
|
134
|
-
specification_version:
|
121
|
+
specification_version: 4
|
135
122
|
summary: Fail specs that start with should.
|
136
123
|
test_files:
|
137
124
|
- integration/minitest.rb
|