should_not 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +29 -0
- data/integration/rspec.rb +29 -0
- data/lib/should_not.rb +5 -0
- data/lib/should_not/rspec.rb +11 -0
- data/lib/should_not/version.rb +3 -0
- data/should_not.gemspec +24 -0
- data/spec/should_not_spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- metadata +116 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Mark Rushakoff
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# should_not
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/mark-rushakoff/should_not.png?branch=master)](https://travis-ci.org/mark-rushakoff/should_not)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/mark-rushakoff/should_not.png)](https://codeclimate.com/github/mark-rushakoff/should_not)
|
5
|
+
|
6
|
+
You `should_not` start your specs with the string `"should"`.
|
7
|
+
Use this gem to enforce that rule.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'should_not'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install should_not
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### RSpec
|
26
|
+
|
27
|
+
In `spec_helper.rb`, add the line:
|
28
|
+
|
29
|
+
require 'should_not/rspec'
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
task :rspec do
|
10
|
+
require 'rspec/core'
|
11
|
+
err = StringIO.new
|
12
|
+
out = StringIO.new
|
13
|
+
RSpec::Core::Runner.run([integration_file('rspec')], err, out)
|
14
|
+
|
15
|
+
assert_contains!(out.string, '6 examples, 2 failures')
|
16
|
+
end
|
17
|
+
|
18
|
+
INTEGRATION_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'integration'))
|
19
|
+
|
20
|
+
def integration_file(filename)
|
21
|
+
filename << '.rb' unless filename.end_with?('.rb')
|
22
|
+
File.join(INTEGRATION_DIR, filename)
|
23
|
+
end
|
24
|
+
|
25
|
+
def assert_contains!(actual, expected)
|
26
|
+
unless actual.include?(expected)
|
27
|
+
abort("Expected (<<OUTPUT\n#{actual}\nOUTPUT)\n to include #{expected}")
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'should_not/rspec'
|
2
|
+
|
3
|
+
describe RSpec do
|
4
|
+
it 'should fail when the string starts with should' do
|
5
|
+
1.should == 1
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'can pass a normal test' do
|
9
|
+
1.should == 1
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should allow should on an "it" through metadata', :should => true do
|
13
|
+
1.should == 1
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'a nested context' do
|
17
|
+
it 'should also fail when the string starts with should' do
|
18
|
+
1.should == 1
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'can also pass a normal test' do
|
22
|
+
1.should == 1
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should also allow should on an "it" through metadata', :should => true do
|
26
|
+
1.should == 1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/should_not.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
STARTS_WITH_SHOULD = /\Ashould\s/.freeze
|
5
|
+
config.before(:each) do
|
6
|
+
next if example.metadata[:should] == true
|
7
|
+
# Not sure that last is correct here -- is the array ever larger than one element?
|
8
|
+
description = example.metadata[:description_args].last.to_s
|
9
|
+
fail("You should_not start an example with should!") if description.match(STARTS_WITH_SHOULD)
|
10
|
+
end
|
11
|
+
end
|
data/should_not.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'should_not/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "should_not"
|
8
|
+
spec.version = ShouldNot::VERSION
|
9
|
+
spec.authors = ["Mark Rushakoff"]
|
10
|
+
spec.email = ["mark.rushakoff@gmail.com"]
|
11
|
+
spec.description = %q{You should_not start your specs with the string "should".}
|
12
|
+
spec.summary = %q{Fail specs that start with should.}
|
13
|
+
spec.homepage = "https://github.com/mark-rushakoff/should_not"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: should_not
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mark Rushakoff
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: You should_not start your specs with the string "should".
|
63
|
+
email:
|
64
|
+
- mark.rushakoff@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- .travis.yml
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- integration/rspec.rb
|
77
|
+
- lib/should_not.rb
|
78
|
+
- lib/should_not/rspec.rb
|
79
|
+
- lib/should_not/version.rb
|
80
|
+
- should_not.gemspec
|
81
|
+
- spec/should_not_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
homepage: https://github.com/mark-rushakoff/should_not
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -3807308310444875557
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
hash: -3807308310444875557
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.8.25
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: Fail specs that start with should.
|
114
|
+
test_files:
|
115
|
+
- spec/should_not_spec.rb
|
116
|
+
- spec/spec_helper.rb
|