rspec-core 2.5.0 → 2.5.1
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.
- data/features/Autotest.md +9 -39
- data/features/Changelog.md +17 -0
- data/lib/autotest/rspec2.rb +2 -51
- data/lib/rspec/core/version.rb +1 -1
- data/spec/autotest/rspec_spec.rb +4 -126
- metadata +5 -5
data/features/Autotest.md
CHANGED
@@ -1,44 +1,14 @@
|
|
1
|
-
RSpec ships with a specialized subclass of Autotest.
|
2
|
-
|
3
|
-
|
4
|
-
$ autotest --style rspec2
|
5
|
-
|
6
|
-
Alternatively, you can configure your project such that this happens
|
7
|
-
automatically, in which case you can just type:
|
1
|
+
RSpec ships with a specialized subclass of Autotest. To tell RSpec to tell
|
2
|
+
Autotest to use RSpec's extension, just add a `.rspec` file to your project's
|
3
|
+
root directory. Then, just type:
|
8
4
|
|
9
5
|
$ autotest
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
#### rspec-2.3 and up
|
14
|
-
|
15
|
-
Add a .rspec file to the project's root directory if it's not already there.
|
16
|
-
You can use this to configure RSpec options, but you don't have to. As long as
|
17
|
-
RSpec sees this file, it will tell Autotest to use the "rspec2" style.
|
18
|
-
|
19
|
-
#### rspec-2.2 and down
|
20
|
-
|
21
|
-
Add an autotest directory to the project root, and add a file named discover.rb to
|
22
|
-
that directory with the following:
|
23
|
-
|
24
|
-
# in ./autotest/discover.rb
|
25
|
-
Autotest.add_discovery {"rspec2"}
|
26
|
-
|
27
|
-
NOTE that this approach will not be supported by future versions of ZenTest on
|
28
|
-
Ruby-1.9.
|
29
|
-
|
30
|
-
### `bundle exec`
|
31
|
-
|
32
|
-
By default, RSpec adds `bundle exec` to the command generated by Autotest if
|
33
|
-
there is a `Gemfile` in the project root directory.
|
34
|
-
|
35
|
-
As of rspec-core-2.5, this automatic inclusion of 'bundle exec' is deprecated.
|
36
|
-
If you want to include 'bundle exec', use Autotest's bundler plugin by adding
|
37
|
-
a .autotest file to the project root directory with the following:
|
38
|
-
|
39
|
-
require 'autotest/bundler'
|
7
|
+
### Bundler
|
40
8
|
|
41
|
-
If you
|
42
|
-
|
9
|
+
If you are using Bundler in your app, and you want the shell command to include
|
10
|
+
`bundle exec`, require the Autotest bundler plugin in a `.autotest` file in the project's
|
11
|
+
root directory or your home directory:
|
43
12
|
|
44
|
-
|
13
|
+
# in .autotest
|
14
|
+
require "autotest/bundler"
|
data/features/Changelog.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 2.5.1 / 2011-02-05
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.0...v2.5.1)
|
4
|
+
|
5
|
+
NOTE: this release breaks compatibility with rspec/autotest/bundler
|
6
|
+
integration, but does so in order to greatly simplify it.
|
7
|
+
|
8
|
+
With this release, if you want the generated autotest command to include
|
9
|
+
'bundle exec', require Autotest's bundler plugin in a .autotest file in the
|
10
|
+
project's root directory or in your home directory:
|
11
|
+
|
12
|
+
require "autotest/bundler"
|
13
|
+
|
14
|
+
Now you can just type 'autotest' on the commmand line and it will work as you expect.
|
15
|
+
|
16
|
+
If you don't want 'bundle exec', there is nothing you have to do.
|
17
|
+
|
1
18
|
### 2.5.0 / 2011-02-05
|
2
19
|
|
3
20
|
[full changelog](http://github.com/rspec/rspec-core/compare/v2.4.0...v2.5.0)
|
data/lib/autotest/rspec2.rb
CHANGED
@@ -5,15 +5,10 @@ class RSpecCommandError < StandardError; end
|
|
5
5
|
|
6
6
|
class Autotest::Rspec2 < Autotest
|
7
7
|
|
8
|
-
attr_reader :cl_args, :skip_bundler
|
9
|
-
alias_method :skip_bundler?, :skip_bundler
|
10
|
-
|
11
8
|
SPEC_PROGRAM = File.expand_path('../../../bin/rspec', __FILE__)
|
12
9
|
|
13
10
|
def initialize
|
14
11
|
super()
|
15
|
-
@cl_args = ARGV.dup << "--tty"
|
16
|
-
@skip_bundler = @cl_args.delete("--skip-bundler")
|
17
12
|
clear_mappings
|
18
13
|
setup_rspec_project_mappings
|
19
14
|
|
@@ -46,9 +41,8 @@ class Autotest::Rspec2 < Autotest
|
|
46
41
|
end
|
47
42
|
|
48
43
|
def make_test_cmd(files_to_test)
|
49
|
-
warn_about_bundler if rspec_wants_bundler? && !autotest_wants_bundler?
|
50
44
|
files_to_test.empty? ? '' :
|
51
|
-
"#{prefix}#{ruby}#{suffix} -S #{SPEC_PROGRAM}
|
45
|
+
"#{prefix}#{ruby}#{suffix} -S #{SPEC_PROGRAM} --tty #{normalize(files_to_test).keys.flatten.map { |f| "'#{f}'"}.join(' ')}"
|
52
46
|
end
|
53
47
|
|
54
48
|
def normalize(files_to_test)
|
@@ -58,55 +52,12 @@ class Autotest::Rspec2 < Autotest
|
|
58
52
|
end
|
59
53
|
end
|
60
54
|
|
61
|
-
def warn_about_bundler
|
62
|
-
RSpec.warn_deprecation <<-WARNING
|
63
|
-
|
64
|
-
****************************************************************************
|
65
|
-
DEPRECATION WARNING: you are using deprecated behaviour that will be removed
|
66
|
-
from a future version of RSpec.
|
67
|
-
|
68
|
-
RSpec's autotest extension is relying on the presence of a Gemfile in the
|
69
|
-
project root directory to generate a command including 'bundle exec'.
|
70
|
-
|
71
|
-
You have two options to suppress this message:
|
72
|
-
|
73
|
-
If you want to include 'bundle exec' in the command, add a .autotest file to
|
74
|
-
the project root with the following content:
|
75
|
-
|
76
|
-
require 'autotest/bundler'
|
77
|
-
|
78
|
-
If you want to _not_include 'bundle exec' in the command, pass --skip-bundler
|
79
|
-
to autotest as an extra argument, like this:
|
80
|
-
|
81
|
-
autotest -- --skip-bundler
|
82
|
-
*****************************************************************
|
83
|
-
WARNING
|
84
|
-
end
|
85
|
-
|
86
|
-
alias_method :autotest_prefix, :prefix
|
87
|
-
|
88
|
-
def rspec_prefix
|
89
|
-
(rspec_wants_bundler? && !autotest_wants_bundler?) ? "bundle exec " : ""
|
90
|
-
end
|
91
|
-
|
92
|
-
def prefix
|
93
|
-
skip_bundler? ? "#{rspec_prefix}#{autotest_prefix}".gsub("bundle exec","") : "#{rspec_prefix}#{autotest_prefix}"
|
94
|
-
end
|
95
|
-
|
96
|
-
def autotest_wants_bundler?
|
97
|
-
autotest_prefix =~ /bundle exec/
|
98
|
-
end
|
99
|
-
|
100
55
|
def suffix
|
101
56
|
using_bundler? ? "" : defined?(:Gem) ? " -rrubygems" : ""
|
102
57
|
end
|
103
58
|
|
104
|
-
def rspec_wants_bundler?
|
105
|
-
gemfile? && !skip_bundler?
|
106
|
-
end
|
107
|
-
|
108
59
|
def using_bundler?
|
109
|
-
|
60
|
+
prefix =~ /bundle exec/
|
110
61
|
end
|
111
62
|
|
112
63
|
def gemfile?
|
data/lib/rspec/core/version.rb
CHANGED
data/spec/autotest/rspec_spec.rb
CHANGED
@@ -6,135 +6,13 @@ describe Autotest::Rspec2 do
|
|
6
6
|
let(:ruby_cmd) { "ruby" }
|
7
7
|
|
8
8
|
before do
|
9
|
-
RSpec.stub(:warn_deprecation)
|
10
9
|
File.stub(:exist?) { false }
|
11
|
-
@orig_argv = ARGV.dup; ARGV.clear
|
12
10
|
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
ARGV.concat(%w[-c -f d])
|
19
|
-
rspec_autotest.cl_args.should eq(%w[-c -f d --tty])
|
20
|
-
end
|
21
|
-
|
22
|
-
context "with --skip-bundler" do
|
23
|
-
before do
|
24
|
-
ARGV.concat(%w[--skip-bundler])
|
25
|
-
end
|
26
|
-
it "extracts --skip-bundler" do
|
27
|
-
rspec_autotest.cl_args.should eq(%w[--tty])
|
28
|
-
end
|
29
|
-
|
30
|
-
it "sets skip_bundler? true" do
|
31
|
-
rspec_autotest.skip_bundler?.should be_true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "handling bundler" do
|
37
|
-
context "gemfile, no prefix" do
|
38
|
-
before do
|
39
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
40
|
-
end
|
41
|
-
|
42
|
-
it "warns of deprecation of implicit inclusion of 'bundle exec'" do
|
43
|
-
RSpec.should_receive(:warn_deprecation)
|
44
|
-
rspec_autotest.make_test_cmd({})
|
45
|
-
end
|
46
|
-
|
47
|
-
it "includes bundle exec" do
|
48
|
-
rspec_autotest.
|
49
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "gemfile, no prefix, --skip-bundler" do
|
54
|
-
before do
|
55
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
56
|
-
ARGV.concat(%w[--skip-bundler])
|
57
|
-
end
|
58
|
-
|
59
|
-
it "does not warn" do
|
60
|
-
RSpec.should_not_receive(:warn_deprecation)
|
61
|
-
rspec_autotest.make_test_cmd({})
|
62
|
-
end
|
63
|
-
|
64
|
-
it "does not include bundle exec" do
|
65
|
-
rspec_autotest.
|
66
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "no gemfile, prefix" do
|
71
|
-
before do
|
72
|
-
File.stub(:exist?).with("./Gemfile") { false }
|
73
|
-
end
|
74
|
-
|
75
|
-
it "does not warn" do
|
76
|
-
RSpec.should_not_receive(:warn_deprecation)
|
77
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
78
|
-
end
|
79
|
-
|
80
|
-
it "includes bundle exec" do
|
81
|
-
rspec_autotest.prefix = "bundle exec "
|
82
|
-
rspec_autotest.
|
83
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
context "gemfile, prefix" do
|
88
|
-
before do
|
89
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
90
|
-
rspec_autotest.prefix = "bundle exec "
|
91
|
-
end
|
92
|
-
|
93
|
-
it "does not warn" do
|
94
|
-
RSpec.should_not_receive(:warn_deprecation)
|
95
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
96
|
-
end
|
97
|
-
|
98
|
-
it "includes bundle exec" do
|
99
|
-
rspec_autotest.prefix = "bundle exec "
|
100
|
-
rspec_autotest.
|
101
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context "gemfile, prefix, --skip-bundler" do
|
106
|
-
before do
|
107
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
108
|
-
rspec_autotest.prefix = "bundle exec "
|
109
|
-
rspec_autotest.stub(:skip_bundler?) { true }
|
110
|
-
end
|
111
|
-
|
112
|
-
it "does not warn" do
|
113
|
-
RSpec.should_not_receive(:warn_deprecation)
|
114
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
115
|
-
end
|
116
|
-
|
117
|
-
it "does not include bundle exec" do
|
118
|
-
rspec_autotest.
|
119
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context "no gemfile, no prefix" do
|
124
|
-
before do
|
125
|
-
File.stub(:exist?).with("./Gemfile") { false }
|
126
|
-
end
|
127
|
-
|
128
|
-
it "does not warn" do
|
129
|
-
RSpec.should_not_receive(:warn_deprecation)
|
130
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
131
|
-
end
|
132
|
-
|
133
|
-
it "does not include bundle exec" do
|
134
|
-
rspec_autotest.
|
135
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
136
|
-
end
|
137
|
-
end
|
12
|
+
it "uses autotest's prefix" do
|
13
|
+
rspec_autotest.prefix = "this is the prefix "
|
14
|
+
rspec_autotest.
|
15
|
+
make_test_cmd({'a' => 'b'}).should match(/this is the prefix/)
|
138
16
|
end
|
139
17
|
|
140
18
|
describe "commands" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 2.5.
|
9
|
+
- 1
|
10
|
+
version: 2.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chad Humphries
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-06 00:00:00 -06:00
|
20
20
|
default_executable: rspec
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -230,7 +230,7 @@ rubyforge_project: rspec
|
|
230
230
|
rubygems_version: 1.3.7
|
231
231
|
signing_key:
|
232
232
|
specification_version: 3
|
233
|
-
summary: rspec-core-2.5.
|
233
|
+
summary: rspec-core-2.5.1
|
234
234
|
test_files:
|
235
235
|
- features/Autotest.md
|
236
236
|
- features/Changelog.md
|