rspec-core 2.6.0.rc6 → 2.6.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.
- data/features/.nav +9 -9
- data/features/Changelog.md +10 -19
- data/features/command_line/README.md +22 -0
- data/features/formatters/text_formatter.feature +2 -4
- data/features/hooks/around_hooks.feature +7 -0
- data/features/metadata/user_defined.feature +3 -3
- data/lib/rspec/core.rb +7 -0
- data/lib/rspec/core/command_line.rb +1 -1
- data/lib/rspec/core/configuration.rb +13 -2
- data/lib/rspec/core/example_group.rb +5 -5
- data/lib/rspec/core/runner.rb +31 -12
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +5 -1
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +1 -0
- data/spec/rspec/core/command_line_spec.rb +36 -0
- data/spec/rspec/core/drb_command_line_spec.rb +19 -46
- data/spec/rspec/core/runner_spec.rb +9 -2
- data/spec/rspec/core/world_spec.rb +11 -0
- data/spec/support/spec_files.rb +44 -0
- metadata +11 -15
- data/spec/ruby_forker.rb +0 -13
data/features/.nav
CHANGED
@@ -5,6 +5,15 @@
|
|
5
5
|
- basic_structure.feature
|
6
6
|
- shared_example_group.feature
|
7
7
|
- shared_context.feature
|
8
|
+
- command_line:
|
9
|
+
- configure.feature
|
10
|
+
- example_name_option.feature
|
11
|
+
- format_option.feature
|
12
|
+
- line_number_option.feature
|
13
|
+
- tag.feature
|
14
|
+
- line_number_appended_to_path.feature
|
15
|
+
- exit_status.feature
|
16
|
+
- rake_task.feature
|
8
17
|
- pending:
|
9
18
|
- pending_examples.feature
|
10
19
|
- hooks:
|
@@ -29,15 +38,6 @@
|
|
29
38
|
- exclusion_filters.feature
|
30
39
|
- if_and_unless.feature
|
31
40
|
- run_all_when_everything_filtered.feature
|
32
|
-
- command_line:
|
33
|
-
- configure.feature
|
34
|
-
- example_name_option.feature
|
35
|
-
- format_option.feature
|
36
|
-
- line_number_option.feature
|
37
|
-
- tag.feature
|
38
|
-
- line_number_appended_to_path.feature
|
39
|
-
- exit_status.feature
|
40
|
-
- rake_task.feature
|
41
41
|
- configuration:
|
42
42
|
- read_options_from_file.feature
|
43
43
|
- fail_fast.feature
|
data/features/Changelog.md
CHANGED
@@ -1,21 +1,6 @@
|
|
1
|
-
### 2.6.0
|
1
|
+
### 2.6.0 / 2011-05-12
|
2
2
|
|
3
|
-
[full changelog](http://github.com/rspec/rspec-core/compare/v2.
|
4
|
-
|
5
|
-
* Enhancements
|
6
|
-
* Restore --pattern/-P command line option from rspec-1
|
7
|
-
* Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)
|
8
|
-
|
9
|
-
### 2.6.0.rc4 / 2011-05-01
|
10
|
-
|
11
|
-
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.0.rc2...v2.6.0.rc4)
|
12
|
-
|
13
|
-
* Enhancements
|
14
|
-
* Clean up messages for filters/tags.
|
15
|
-
|
16
|
-
### 2.6.0.rc2 / 2011-04-18
|
17
|
-
|
18
|
-
[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.0.rc2)
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.0)
|
19
4
|
|
20
5
|
* Enhancements
|
21
6
|
* `shared_context` (Damian Nurzynski)
|
@@ -31,8 +16,11 @@
|
|
31
16
|
defined. (Myron Marston)
|
32
17
|
* Pass the exit status of a DRb run to the invoking process. This causes
|
33
18
|
specs run via DRb to not just return true or false. (Ilkka Laukkanen)
|
34
|
-
* Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
|
19
|
+
* Refactoring of `ConfigurationOptions#parse_options` (Rodrigo Rosenfeld Rosas)
|
35
20
|
* Report excluded filters in runner output (tip from andyl)
|
21
|
+
* Clean up messages for filters/tags.
|
22
|
+
* Restore --pattern/-P command line option from rspec-1
|
23
|
+
* Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)
|
36
24
|
|
37
25
|
* Bug fixes
|
38
26
|
* Don't stumble over an exception without a message (Hans Hasselberg)
|
@@ -43,12 +31,15 @@
|
|
43
31
|
* Include RSpec::Matchers when first example group is defined, rather
|
44
32
|
than just before running the examples. This works around an obscure
|
45
33
|
bug in ruby 1.9 that can cause infinite recursion. (Myron Marston)
|
46
|
-
* Don't send example_group_[started|finished] to formatters for empty groups.
|
34
|
+
* Don't send `example_group_[started|finished]` to formatters for empty groups.
|
47
35
|
* Get specs passing on jruby (Sidu Ponnappa)
|
48
36
|
* Fix bug where mixing nested groups and outer-level examples gave
|
49
37
|
unpredictable :line_number behavior (Artur Małecki)
|
50
38
|
* Regexp.escape the argument to --example (tip from Elliot Winkler)
|
51
39
|
* Correctly pass/fail pending block with message expectations
|
40
|
+
* CommandLine returns exit status (0/1) instead of true/false
|
41
|
+
* Create path to formatter output file if it doesn't exist (marekj).
|
42
|
+
|
52
43
|
|
53
44
|
### 2.5.1 / 2011-02-06
|
54
45
|
|
@@ -4,3 +4,25 @@ behavior, including output formats, filtering examples, etc.
|
|
4
4
|
For a full list of options, run the `rspec` command with the `--help` flag:
|
5
5
|
|
6
6
|
$ rspec --help
|
7
|
+
|
8
|
+
### Run with `ruby`
|
9
|
+
|
10
|
+
Generally, life is simpler if you just use the `rspec` command. If you must use the `ruby`
|
11
|
+
command, however, you'll want to do the following:
|
12
|
+
|
13
|
+
* `require 'rspec/autorun'`
|
14
|
+
|
15
|
+
This tells RSpec to run your examples. Do this in any file that you are
|
16
|
+
passing to the `ruby` command.
|
17
|
+
|
18
|
+
* Update the `LOAD_PATH`
|
19
|
+
|
20
|
+
It is conventional to put configuration in and require assorted support files
|
21
|
+
from `spec/spec_helper.rb`. It is also conventional to require that file from
|
22
|
+
the spec files using `require 'spec_helper'`. This works because RSpec
|
23
|
+
implicitly adds the `spec` directory to the `LOAD_PATH`. It also adds `lib`, so
|
24
|
+
your implementation files will be on the `LOAD_PATH` as well.
|
25
|
+
|
26
|
+
If you're using the `ruby` command, you'll need to do this yourself:
|
27
|
+
|
28
|
+
ruby -Ilib -Ispec path/to/spec.rb
|
@@ -7,8 +7,6 @@ Feature: text formatter
|
|
7
7
|
Scenario: Backtrace formatting for failing specs in multiple files
|
8
8
|
Given a file named "string_spec.rb" with:
|
9
9
|
"""
|
10
|
-
require 'rspec/core'
|
11
|
-
|
12
10
|
describe String do
|
13
11
|
it "has a failing example" do
|
14
12
|
"foo".reverse.should == "ofo"
|
@@ -17,7 +15,7 @@ Feature: text formatter
|
|
17
15
|
"""
|
18
16
|
And a file named "integer_spec.rb" with:
|
19
17
|
"""
|
20
|
-
require 'rspec/
|
18
|
+
require 'rspec/autorun'
|
21
19
|
|
22
20
|
describe Integer do
|
23
21
|
it "has a failing example" do
|
@@ -40,6 +38,6 @@ Feature: text formatter
|
|
40
38
|
Failure/Error: "foo".reverse.should == "ofo"
|
41
39
|
expected: "ofo"
|
42
40
|
got: "oof" (using ==)
|
43
|
-
# ./string_spec.rb:
|
41
|
+
# ./string_spec.rb:3
|
44
42
|
"""
|
45
43
|
|
@@ -9,6 +9,13 @@ Feature: around hooks
|
|
9
9
|
example, if your database library offers a transaction method that receives
|
10
10
|
a block, you can use an around hook as described in the first scenario:
|
11
11
|
|
12
|
+
WARNING: around hooks do not share state with the example the way before and
|
13
|
+
after hooks do. This means that you can not share instance variables between
|
14
|
+
around hooks and examples.
|
15
|
+
|
16
|
+
Also, mock frameworks are set up and torn down within the context of running
|
17
|
+
the example, so you can not interact with them directly in around hooks.
|
18
|
+
|
12
19
|
Scenario: use the example as a proc within the block passed to around()
|
13
20
|
Given a file named "example_spec.rb" with:
|
14
21
|
"""
|
@@ -5,7 +5,7 @@ Feature: User-defined metadata
|
|
5
5
|
`context` or `it`. RSpec supports many configuration options that apply
|
6
6
|
only to certain examples or groups based on the metadata.
|
7
7
|
|
8
|
-
Metadata defined on an example group is available (and can be
|
8
|
+
Metadata defined on an example group is available (and can be overridden)
|
9
9
|
by any sub-group or from any example in that group or a sub-group.
|
10
10
|
|
11
11
|
In addition, there is a configuration option (which will be the default
|
@@ -68,12 +68,12 @@ Feature: User-defined metadata
|
|
68
68
|
Given a file named "override_metadata_spec.rb" with:
|
69
69
|
"""
|
70
70
|
describe "a group with user-defined metadata", :foo => 'bar' do
|
71
|
-
it 'can be
|
71
|
+
it 'can be overridden by an example', :foo => 'bazz' do
|
72
72
|
example.metadata[:foo].should == 'bazz'
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "a sub-group with an override", :foo => 'goo' do
|
76
|
-
it 'can be
|
76
|
+
it 'can be overridden by a sub-group' do
|
77
77
|
example.metadata[:foo].should == 'goo'
|
78
78
|
end
|
79
79
|
end
|
data/lib/rspec/core.rb
CHANGED
@@ -49,6 +49,13 @@ module RSpec
|
|
49
49
|
@world ||= RSpec::Core::World.new
|
50
50
|
end
|
51
51
|
|
52
|
+
# Used internally to ensure examples get reloaded between multiple runs in
|
53
|
+
# the same process.
|
54
|
+
def self.reset
|
55
|
+
world.reset
|
56
|
+
configuration.reset
|
57
|
+
end
|
58
|
+
|
52
59
|
def self.configuration
|
53
60
|
@configuration ||= RSpec::Core::Configuration.new
|
54
61
|
end
|
@@ -21,7 +21,7 @@ module RSpec
|
|
21
21
|
@configuration.reporter.report(@world.example_count) do |reporter|
|
22
22
|
begin
|
23
23
|
@configuration.run_hook(:before, :suite)
|
24
|
-
@world.example_groups.map {|g| g.run(reporter)}.all?
|
24
|
+
@world.example_groups.map {|g| g.run(reporter)}.all? ? 0 : 1
|
25
25
|
ensure
|
26
26
|
@configuration.run_hook(:after, :suite)
|
27
27
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rbconfig"
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
module RSpec
|
4
5
|
module Core
|
@@ -59,6 +60,10 @@ module RSpec
|
|
59
60
|
self.exclusion_filter = CONDITIONAL_FILTERS.dup
|
60
61
|
end
|
61
62
|
|
63
|
+
def reset
|
64
|
+
@reporter = nil
|
65
|
+
end
|
66
|
+
|
62
67
|
# :call-seq:
|
63
68
|
# add_setting(:name)
|
64
69
|
# add_setting(:name, :default => "default_value")
|
@@ -269,13 +274,13 @@ EOM
|
|
269
274
|
filter_run({ :full_description => /#{description}/ }, true)
|
270
275
|
end
|
271
276
|
|
272
|
-
def add_formatter(formatter_to_use,
|
277
|
+
def add_formatter(formatter_to_use, path=nil)
|
273
278
|
formatter_class =
|
274
279
|
built_in_formatter(formatter_to_use) ||
|
275
280
|
custom_formatter(formatter_to_use) ||
|
276
281
|
(raise ArgumentError, "Formatter '#{formatter_to_use}' unknown - maybe you meant 'documentation' or 'progress'?.")
|
277
282
|
|
278
|
-
formatters << formatter_class.new(
|
283
|
+
formatters << formatter_class.new(path ? file_at(path) : output)
|
279
284
|
end
|
280
285
|
|
281
286
|
alias_method :formatter=, :add_formatter
|
@@ -486,6 +491,12 @@ MESSAGE
|
|
486
491
|
word.downcase!
|
487
492
|
word
|
488
493
|
end
|
494
|
+
|
495
|
+
def file_at(path)
|
496
|
+
FileUtils.mkdir_p(File.dirname(path))
|
497
|
+
File.new(path, 'w')
|
498
|
+
end
|
499
|
+
|
489
500
|
end
|
490
501
|
end
|
491
502
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Core
|
3
3
|
class ExampleGroup
|
4
|
+
extend MetadataHashBuilder::WithDeprecationWarning
|
4
5
|
extend Extensions::ModuleEvalWithArgs
|
5
|
-
include Extensions::InstanceEvalWithArgs
|
6
|
-
extend Hooks
|
7
6
|
extend Subject::ClassMethods
|
7
|
+
extend Hooks
|
8
|
+
|
9
|
+
include Extensions::InstanceEvalWithArgs
|
8
10
|
include Subject::InstanceMethods
|
9
|
-
include Let
|
10
11
|
include Pending
|
11
|
-
|
12
|
+
include Let
|
12
13
|
|
13
14
|
attr_accessor :example
|
14
15
|
|
@@ -22,7 +23,6 @@ module RSpec
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.register
|
25
|
-
RSpec::Core::Runner.autorun
|
26
26
|
world.register(self)
|
27
27
|
end
|
28
28
|
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -4,31 +4,32 @@ module RSpec
|
|
4
4
|
module Core
|
5
5
|
class Runner
|
6
6
|
|
7
|
+
# Register an at_exit hook that runs the suite.
|
7
8
|
def self.autorun
|
8
9
|
return if autorun_disabled? || installed_at_exit? || running_in_drb?
|
9
10
|
@installed_at_exit = true
|
10
|
-
at_exit { run(ARGV, $stderr, $stdout)
|
11
|
+
at_exit { exit(run(ARGV, $stderr, $stdout)) }
|
11
12
|
end
|
12
13
|
AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
|
13
14
|
|
14
|
-
def self.autorun_disabled?
|
15
|
-
@autorun_disabled ||= false
|
16
|
-
end
|
17
|
-
|
18
15
|
def self.disable_autorun!
|
19
16
|
@autorun_disabled = true
|
20
17
|
end
|
21
18
|
|
22
|
-
def self.
|
19
|
+
def self.autorun_disabled? # :nodoc:
|
20
|
+
@autorun_disabled ||= false
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.installed_at_exit? # :nodoc:
|
23
24
|
@installed_at_exit ||= false
|
24
25
|
end
|
25
26
|
|
26
|
-
def self.running_in_drb?
|
27
|
-
(DRb.current_server rescue false) &&
|
27
|
+
def self.running_in_drb? # :nodoc:
|
28
|
+
(DRb.current_server rescue false) &&
|
28
29
|
DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
|
29
30
|
end
|
30
31
|
|
31
|
-
def self.trap_interrupt
|
32
|
+
def self.trap_interrupt # :nodoc:
|
32
33
|
trap('INT') do
|
33
34
|
exit!(1) if RSpec.wants_to_quit
|
34
35
|
RSpec.wants_to_quit = true
|
@@ -36,7 +37,23 @@ module RSpec
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
|
-
|
40
|
+
# Run a suite of RSpec examples.
|
41
|
+
#
|
42
|
+
# This is used internally by RSpec to run a suite, but is available
|
43
|
+
# for use by any other automation tool.
|
44
|
+
#
|
45
|
+
# If you want to run this multiple times in the same process, and you
|
46
|
+
# want files like spec_helper.rb to be reloaded, be sure to load `load`
|
47
|
+
# instead of `require`.
|
48
|
+
#
|
49
|
+
# ==== Parameters
|
50
|
+
# * +args+ - an array of command-line-supported arguments
|
51
|
+
# * +err+ - error stream (Default: $stderr)
|
52
|
+
# * +out+ - output stream (Default: $stdout)
|
53
|
+
#
|
54
|
+
# ==== Returns
|
55
|
+
# * +Fixnum+ - exit status code (0/1)
|
56
|
+
def self.run(args, err=$stderr, out=$stdout)
|
40
57
|
trap_interrupt
|
41
58
|
options = ConfigurationOptions.new(args)
|
42
59
|
options.parse_options
|
@@ -51,13 +68,15 @@ module RSpec
|
|
51
68
|
else
|
52
69
|
run_in_process(options, err, out)
|
53
70
|
end
|
71
|
+
ensure
|
72
|
+
RSpec.reset
|
54
73
|
end
|
55
74
|
|
56
|
-
def self.run_over_drb(options, err, out)
|
75
|
+
def self.run_over_drb(options, err, out) # :nodoc:
|
57
76
|
DRbCommandLine.new(options).run(err, out)
|
58
77
|
end
|
59
78
|
|
60
|
-
def self.run_in_process(options, err, out)
|
79
|
+
def self.run_in_process(options, err, out) # :nodoc:
|
61
80
|
CommandLine.new(options, RSpec::configuration, RSpec::world).run(err, out)
|
62
81
|
end
|
63
82
|
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
@@ -41,6 +41,10 @@ module RSpec
|
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
+
def reset
|
45
|
+
example_groups.clear
|
46
|
+
end
|
47
|
+
|
44
48
|
def register(example_group)
|
45
49
|
example_groups << example_group
|
46
50
|
example_group
|
@@ -112,7 +116,7 @@ module RSpec
|
|
112
116
|
reporter.message(
|
113
117
|
"No examples were matched. Perhaps #{exclusion_filter.description} is excluding everything?")
|
114
118
|
end
|
115
|
-
|
119
|
+
elsif !filter_announcements.empty?
|
116
120
|
reporter.message("Run filtered #{filter_announcements.join(', ')}")
|
117
121
|
end
|
118
122
|
end
|
@@ -4,6 +4,42 @@ require 'tmpdir'
|
|
4
4
|
|
5
5
|
module RSpec::Core
|
6
6
|
describe CommandLine do
|
7
|
+
|
8
|
+
describe "#run" do
|
9
|
+
include_context "spec files"
|
10
|
+
|
11
|
+
let(:out) { StringIO.new }
|
12
|
+
let(:err) { StringIO.new }
|
13
|
+
|
14
|
+
def config_options(argv=[])
|
15
|
+
options = RSpec::Core::ConfigurationOptions.new(argv)
|
16
|
+
options.parse_options
|
17
|
+
options
|
18
|
+
end
|
19
|
+
|
20
|
+
def command_line(args)
|
21
|
+
RSpec::Core::CommandLine.new(config_options(args))
|
22
|
+
end
|
23
|
+
|
24
|
+
def config_options(argv=[])
|
25
|
+
options = RSpec::Core::ConfigurationOptions.new(argv)
|
26
|
+
options.parse_options
|
27
|
+
options
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns 0 if spec passes" do
|
31
|
+
err, out = StringIO.new, StringIO.new
|
32
|
+
result = command_line([passing_spec_filename]).run(err, out)
|
33
|
+
result.should be(0)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns 1 if spec passes" do
|
37
|
+
err, out = StringIO.new, StringIO.new
|
38
|
+
result = command_line([failing_spec_filename]).run(err, out)
|
39
|
+
result.should be(1)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
7
43
|
context "given an Array of options" do
|
8
44
|
it "assigns ConfigurationOptions built from Array to @options" do
|
9
45
|
config_options = ConfigurationOptions.new(%w[--color])
|
@@ -5,18 +5,20 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
5
5
|
let(:out) { StringIO.new }
|
6
6
|
let(:err) { StringIO.new }
|
7
7
|
|
8
|
+
include_context "spec files"
|
9
|
+
|
10
|
+
def command_line(args)
|
11
|
+
RSpec::Core::DRbCommandLine.new(config_options(args))
|
12
|
+
end
|
13
|
+
|
8
14
|
def config_options(argv=[])
|
9
15
|
options = RSpec::Core::ConfigurationOptions.new(argv)
|
10
16
|
options.parse_options
|
11
17
|
options
|
12
18
|
end
|
13
19
|
|
14
|
-
def drb_command_line(args)
|
15
|
-
RSpec::Core::DRbCommandLine.new(config_options(args))
|
16
|
-
end
|
17
|
-
|
18
20
|
def run_with(args)
|
19
|
-
|
21
|
+
command_line(args).run(err, out)
|
20
22
|
end
|
21
23
|
|
22
24
|
context "without server running" do
|
@@ -39,14 +41,14 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
39
41
|
context "without RSPEC_DRB environment variable set" do
|
40
42
|
it "defaults to 8989" do
|
41
43
|
with_RSPEC_DRB_set_to(nil) do
|
42
|
-
|
44
|
+
command_line([]).drb_port.should == 8989
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
48
|
it "sets the DRb port" do
|
47
49
|
with_RSPEC_DRB_set_to(nil) do
|
48
|
-
|
49
|
-
|
50
|
+
command_line(["--drb-port", "1234"]).drb_port.should == 1234
|
51
|
+
command_line(["--drb-port", "5678"]).drb_port.should == 5678
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -56,7 +58,7 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
56
58
|
context "without config variable set" do
|
57
59
|
it "uses RSPEC_DRB value" do
|
58
60
|
with_RSPEC_DRB_set_to('9000') do
|
59
|
-
|
61
|
+
command_line([]).drb_port.should == "9000"
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
@@ -64,7 +66,7 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
64
66
|
context "and config variable set" do
|
65
67
|
it "uses configured value" do
|
66
68
|
with_RSPEC_DRB_set_to('9000') do
|
67
|
-
|
69
|
+
command_line(%w[--drb-port 5678]).drb_port.should == 5678
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -80,59 +82,30 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
83
|
-
def dummy_spec_filename
|
84
|
-
@dummy_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_dummy_spec#{@drb_example_file_counter}.rb"
|
85
|
-
end
|
86
|
-
|
87
85
|
before(:all) do
|
88
86
|
@drb_port = 8990
|
89
87
|
@drb_example_file_counter = 0
|
90
88
|
DRb::start_service("druby://127.0.0.1:#{@drb_port}", ::FakeDrbSpecServer)
|
91
89
|
end
|
92
90
|
|
93
|
-
before(:each) do
|
94
|
-
@drb_example_file_counter += 1
|
95
|
-
create_dummy_spec_file
|
96
|
-
end
|
97
|
-
|
98
|
-
after(:each) do
|
99
|
-
File.delete(dummy_spec_filename)
|
100
|
-
end
|
101
|
-
|
102
91
|
after(:all) do
|
103
92
|
DRb::stop_service
|
104
93
|
end
|
105
94
|
|
106
|
-
|
107
|
-
File.open(dummy_spec_filename, 'w') do |f|
|
108
|
-
f.write %q{
|
109
|
-
describe "DUMMY CONTEXT for 'DrbCommandLine with -c option'" do
|
110
|
-
it "should be output with green bar" do
|
111
|
-
true.should be_true
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should be output with red bar" do
|
115
|
-
raise("I want to see a red bar!")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
}
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
it "returns true" do
|
95
|
+
it "returns 0 if spec passes" do
|
123
96
|
err, out = StringIO.new, StringIO.new
|
124
|
-
result =
|
125
|
-
result.should
|
97
|
+
result = command_line(["--drb-port", @drb_port.to_s, passing_spec_filename]).run(err, out)
|
98
|
+
result.should be(0)
|
126
99
|
end
|
127
100
|
|
128
|
-
it "
|
101
|
+
it "returns 1 if spec passes" do
|
129
102
|
err, out = StringIO.new, StringIO.new
|
130
|
-
result =
|
131
|
-
result.should
|
103
|
+
result = command_line(["--drb-port", @drb_port.to_s, failing_spec_filename]).run(err, out)
|
104
|
+
result.should be(1)
|
132
105
|
end
|
133
106
|
|
134
107
|
def run_spec_via_druby
|
135
|
-
run_with([
|
108
|
+
run_with([failing_spec_filename, "--colour", "--drb-port", @drb_port.to_s])
|
136
109
|
out.rewind
|
137
110
|
out.read
|
138
111
|
end
|
@@ -21,9 +21,16 @@ module RSpec::Core
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "#run" do
|
24
|
+
let(:err) { StringIO.new }
|
25
|
+
let(:out) { StringIO.new }
|
26
|
+
|
27
|
+
it "resets world and configuration" do
|
28
|
+
RSpec.configuration.should_receive(:reset)
|
29
|
+
RSpec.world.should_receive(:reset)
|
30
|
+
RSpec::Core::Runner.run([], err, out)
|
31
|
+
end
|
32
|
+
|
24
33
|
context "with --drb or -X" do
|
25
|
-
let(:err) { StringIO.new }
|
26
|
-
let(:out) { StringIO.new }
|
27
34
|
|
28
35
|
before(:each) do
|
29
36
|
@options = RSpec::Core::ConfigurationOptions.new(%w[--drb --drb-port 8181 --color])
|
@@ -236,6 +236,17 @@ module RSpec::Core
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
end
|
239
|
+
|
240
|
+
context "with examples" do
|
241
|
+
before { world.stub(:example_count) { 1 } }
|
242
|
+
|
243
|
+
context "with no filters" do
|
244
|
+
it "does not announce" do
|
245
|
+
reporter.should_not_receive(:message)
|
246
|
+
world.announce_filters
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
239
250
|
end
|
240
251
|
|
241
252
|
describe "#inclusion_filter" do
|
@@ -0,0 +1,44 @@
|
|
1
|
+
shared_context "spec files" do
|
2
|
+
def failing_spec_filename
|
3
|
+
@failing_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_failing_spec.rb"
|
4
|
+
end
|
5
|
+
|
6
|
+
def passing_spec_filename
|
7
|
+
@passing_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_passing_spec.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_passing_spec_file
|
11
|
+
File.open(passing_spec_filename, 'w') do |f|
|
12
|
+
f.write %q{
|
13
|
+
describe "passing spec" do
|
14
|
+
it "passes" do
|
15
|
+
1.should eq(1)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_failing_spec_file
|
23
|
+
File.open(failing_spec_filename, 'w') do |f|
|
24
|
+
f.write %q{
|
25
|
+
describe "failing spec" do
|
26
|
+
it "fails" do
|
27
|
+
1.should eq(2)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
before(:all) do
|
35
|
+
create_passing_spec_file
|
36
|
+
create_failing_spec_file
|
37
|
+
end
|
38
|
+
|
39
|
+
after(:all) do
|
40
|
+
File.delete(passing_spec_filename)
|
41
|
+
File.delete(failing_spec_filename)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
9
|
- 0
|
10
|
-
|
11
|
-
- 6
|
12
|
-
version: 2.6.0.rc6
|
10
|
+
version: 2.6.0
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Chad Humphries
|
@@ -18,7 +16,7 @@ autorequire:
|
|
18
16
|
bindir: bin
|
19
17
|
cert_chain: []
|
20
18
|
|
21
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-12 00:00:00 -05:00
|
22
20
|
default_executable:
|
23
21
|
dependencies: []
|
24
22
|
|
@@ -206,10 +204,10 @@ files:
|
|
206
204
|
- spec/rspec/core/subject_spec.rb
|
207
205
|
- spec/rspec/core/world_spec.rb
|
208
206
|
- spec/rspec/core_spec.rb
|
209
|
-
- spec/ruby_forker.rb
|
210
207
|
- spec/spec_helper.rb
|
211
208
|
- spec/support/matchers.rb
|
212
209
|
- spec/support/shared_example_groups.rb
|
210
|
+
- spec/support/spec_files.rb
|
213
211
|
has_rdoc: true
|
214
212
|
homepage: http://github.com/rspec
|
215
213
|
licenses: []
|
@@ -231,21 +229,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
230
|
none: false
|
233
231
|
requirements:
|
234
|
-
- - "
|
232
|
+
- - ">="
|
235
233
|
- !ruby/object:Gem::Version
|
236
|
-
hash:
|
234
|
+
hash: 3
|
237
235
|
segments:
|
238
|
-
-
|
239
|
-
|
240
|
-
- 1
|
241
|
-
version: 1.3.1
|
236
|
+
- 0
|
237
|
+
version: "0"
|
242
238
|
requirements: []
|
243
239
|
|
244
240
|
rubyforge_project: rspec
|
245
241
|
rubygems_version: 1.6.2
|
246
242
|
signing_key:
|
247
243
|
specification_version: 3
|
248
|
-
summary: rspec-core-2.6.0
|
244
|
+
summary: rspec-core-2.6.0
|
249
245
|
test_files:
|
250
246
|
- features/Autotest.md
|
251
247
|
- features/Changelog.md
|
@@ -349,7 +345,7 @@ test_files:
|
|
349
345
|
- spec/rspec/core/subject_spec.rb
|
350
346
|
- spec/rspec/core/world_spec.rb
|
351
347
|
- spec/rspec/core_spec.rb
|
352
|
-
- spec/ruby_forker.rb
|
353
348
|
- spec/spec_helper.rb
|
354
349
|
- spec/support/matchers.rb
|
355
350
|
- spec/support/shared_example_groups.rb
|
351
|
+
- spec/support/spec_files.rb
|
data/spec/ruby_forker.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
module RubyForker
|
4
|
-
# Forks a ruby interpreter with same type as ourself.
|
5
|
-
# jruby will fork jruby, ruby will fork ruby etc.
|
6
|
-
def ruby(args, stderr=nil)
|
7
|
-
config = ::RbConfig::CONFIG
|
8
|
-
interpreter = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
9
|
-
cmd = "#{interpreter} #{args}"
|
10
|
-
cmd << " 2> #{stderr}" unless stderr.nil?
|
11
|
-
`#{cmd}`
|
12
|
-
end
|
13
|
-
end
|