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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb533ccebf76a991b80edbcdabb79eb610e8f51a
4
- data.tar.gz: ce998652aac2583f5de011fe3ad002b8ba9b04d6
3
+ metadata.gz: 1b5447b149f7a66993e669cc2ab00bf4b62469e8
4
+ data.tar.gz: 07fbe6fddc428f8529e0b275559285d44571a9fd
5
5
  SHA512:
6
- metadata.gz: ea45d4141812a6493d2b4f02c4e9d1c06bf14183dbbd8fe5af0896fb850bf0f51e50582680d99fb123315b37575df6166f7b477e8fe54ce58a2ff165d4813e41
7
- data.tar.gz: 2f807440543454b29aed95cdf650d313a7c8b79a08cae832eaf1b1b9f358ae9a9bd59329a80a5b9eb4351f70682073f0ca219dc9f17d40ef50382d37c86c282c
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 [![Gem Version](https://badge.fury.io/rb/dry_require_spec_helper.svg)](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).
@@ -6,12 +6,20 @@ unless File.exist?('.rspec')
6
6
  exit 1
7
7
  end
8
8
 
9
- File.open('.rspec', 'a') {|file| file.write("--require spec_helper\n") }
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 +('spec_helper'|"spec_helper")\n*/ === source
22
+ next unless /require +('(spec|rails)_helper'|"(spec|rails)_helper")\n*/ === source
15
23
 
16
24
  source.gsub!($&, '')
17
25
 
@@ -1,3 +1,3 @@
1
1
  module DryRequireSpecHelper
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
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.3.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-06-18 00:00:00.000000000 Z
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.4.8
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'.