dry_require_spec_helper 0.3.0 → 0.4.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 +11 -5
- data/bin/dry_require_spec_helper +10 -2
- data/lib/dry_require_spec_helper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b5447b149f7a66993e669cc2ab00bf4b62469e8
|
4
|
+
data.tar.gz: 07fbe6fddc428f8529e0b275559285d44571a9fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fef1c1f4fd7bee16986318afec40ae51f15a5e6b6f30d27aa1819900473f9f772c581746fa684809b32ab350671fea946c4fa17068c310857c4fe126944f9e76
|
7
|
+
data.tar.gz: 2042ff23ec80cb091e309ac446cb5087ad3c7fae3366a0017a3545c2762a7c321722d41aed8be928fab6164b42e90cdef5f48e3f11e42969ba4d01d518bfc332
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# dry_require_spec_helper
|
1
|
+
# dry_require_spec_helper [](http://badge.fury.io/rb/dry_require_spec_helper)
|
2
2
|
|
3
3
|
DRY (Don't Repeat Yourself) of `require 'spec_helper'`.
|
4
4
|
|
@@ -7,6 +7,12 @@ DRY (Don't Repeat Yourself) of `require 'spec_helper'`.
|
|
7
7
|
* append `--require spec_helper` to .rspec file.
|
8
8
|
* remove `require 'spec_helper'` from spec files (i.e. `./spec/**/*_spec.rb` in your current working directory) .
|
9
9
|
|
10
|
+
### A little more in detail
|
11
|
+
|
12
|
+
append `--require rails_helper` to .rspec file if rspec-rails >= 3.0.0 in Gemfile.lock.
|
13
|
+
|
14
|
+
otherwise append `--require spec_helper` to .rspec file.
|
15
|
+
|
10
16
|
## HOW TO USE
|
11
17
|
|
12
18
|
```
|
@@ -38,10 +44,6 @@ Or install it yourself as:
|
|
38
44
|
$ gem install dry_require_spec_helper
|
39
45
|
```
|
40
46
|
|
41
|
-
## LICENCE
|
42
|
-
|
43
|
-
The MIT Licence
|
44
|
-
|
45
47
|
## Contributing
|
46
48
|
|
47
49
|
1. Fork it
|
@@ -49,3 +51,7 @@ The MIT Licence
|
|
49
51
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
52
|
4. Push to the branch (`git push origin my-new-feature`)
|
51
53
|
5. Create new Pull Request
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
dry_require_spec_helper is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/bin/dry_require_spec_helper
CHANGED
@@ -6,12 +6,20 @@ unless File.exist?('.rspec')
|
|
6
6
|
exit 1
|
7
7
|
end
|
8
8
|
|
9
|
-
File.
|
9
|
+
helper_name = if File.exist?('Gemfile.lock') &&
|
10
|
+
File.read('Gemfile.lock').split("\n").detect {|gem| /rspec-rails \((\d)\.(\d)\.(\d)\)$/ === gem } &&
|
11
|
+
$1.to_i >= 3
|
12
|
+
'rails_helper'
|
13
|
+
else
|
14
|
+
'spec_helper'
|
15
|
+
end
|
16
|
+
|
17
|
+
File.open('.rspec', 'a') {|file| file.write("--require #{helper_name}\n") }
|
10
18
|
|
11
19
|
Dir['./spec/**/*_spec.rb'].each do |path|
|
12
20
|
source = File.read(path)
|
13
21
|
|
14
|
-
next unless /require +('
|
22
|
+
next unless /require +('(spec|rails)_helper'|"(spec|rails)_helper")\n*/ === source
|
15
23
|
|
16
24
|
source.gsub!($&, '')
|
17
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry_require_spec_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi ITO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: DRY (Don't Repeat Yourself) of require 'spec_helper'.
|
14
14
|
email: koic.ito@gmail.com
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.
|
45
|
+
rubygems_version: 2.5.0
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: DRY (Don't Repeat Yourself) of require 'spec_helper'.
|