rspec 1.1.8 → 1.1.9
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/History.txt +30 -3
- data/License.txt +22 -0
- data/Manifest.txt +3 -3
- data/README.txt +1 -25
- data/Rakefile +4 -2
- data/TODO.txt +5 -4
- data/bin/autospec +1 -1
- data/examples/pure/shared_example_group_example.rb +2 -2
- data/lib/autotest/rspec.rb +1 -1
- data/lib/spec.rb +5 -1
- data/lib/spec/example.rb +1 -1
- data/lib/spec/example/before_and_after_hooks.rb +93 -0
- data/lib/spec/example/configuration.rb +10 -1
- data/lib/spec/example/example_group.rb +2 -1
- data/lib/spec/example/example_group_factory.rb +18 -1
- data/lib/spec/example/example_group_methods.rb +45 -123
- data/lib/spec/example/example_methods.rb +9 -6
- data/lib/spec/example/shared_example_group.rb +6 -12
- data/lib/spec/extensions/main.rb +1 -1
- data/lib/spec/interop/test/unit/testcase.rb +1 -1
- data/lib/spec/mocks/error_generator.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +19 -4
- data/lib/spec/mocks/methods.rb +2 -2
- data/lib/spec/mocks/proxy.rb +4 -5
- data/lib/spec/runner.rb +3 -4
- data/lib/spec/runner/formatter/nested_text_formatter.rb +3 -3
- data/lib/spec/runner/option_parser.rb +23 -22
- data/lib/spec/version.rb +1 -1
- data/rspec.gemspec +19 -8
- data/spec/autotest/rspec_spec.rb +5 -1
- data/spec/spec/example/configuration_spec.rb +229 -215
- data/spec/spec/example/example_group_class_definition_spec.rb +9 -9
- data/spec/spec/example/example_group_factory_spec.rb +48 -27
- data/spec/spec/example/example_group_methods_spec.rb +436 -426
- data/spec/spec/example/example_group_spec.rb +459 -500
- data/spec/spec/example/example_methods_spec.rb +92 -86
- data/spec/spec/example/shared_example_group_spec.rb +219 -203
- data/spec/spec/extensions/main_spec.rb +23 -23
- data/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +13 -0
- data/spec/spec/interop/test/unit/spec_spec.rb +15 -8
- data/spec/spec/mocks/mock_spec.rb +12 -2
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +0 -1
- data/spec/spec/mocks/partial_mock_spec.rb +10 -5
- data/spec/spec/package/bin_spec_spec.rb +8 -0
- data/spec/spec/runner/command_line_spec.rb +101 -100
- data/spec/spec/runner/drb_command_line_spec.rb +0 -2
- data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -4
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +230 -245
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +2 -3
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +110 -109
- data/spec/spec/runner/option_parser_spec.rb +18 -6
- data/spec/spec_helper.rb +26 -5
- data/stories/mock_framework_integration/use_flexmock.story +1 -1
- metadata +38 -7
- data/lib/spec/example/module_inclusion_warnings.rb +0 -38
- data/spec/spec/example/example_group/described_module_spec.rb +0 -20
- data/spec/spec/example/example_group/warning_messages_spec.rb +0 -76
@@ -1,38 +0,0 @@
|
|
1
|
-
module Spec
|
2
|
-
module Example
|
3
|
-
# In the future, modules will no longer be automatically included
|
4
|
-
# in the Example Group (based on the description name); when that
|
5
|
-
# time comes, this code should be removed.
|
6
|
-
module ModuleInclusionWarnings
|
7
|
-
# Thanks, Francis Hwang.
|
8
|
-
class MethodDispatcher
|
9
|
-
def initialize(mod, target=nil)
|
10
|
-
@mod = mod
|
11
|
-
@target = target
|
12
|
-
end
|
13
|
-
|
14
|
-
def respond_to?(sym)
|
15
|
-
@mod && @mod.instance_methods.include?(sym.to_s)
|
16
|
-
end
|
17
|
-
|
18
|
-
def call(sym, *args, &blk)
|
19
|
-
Kernel.warn("Modules will no longer be automatically included in RSpec version 1.1.4. Called from #{caller[2]}")
|
20
|
-
@target.extend @mod
|
21
|
-
@target.send(sym, *args, &blk)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# NOTE - we don't need the second arg, but extenders do: http://www.ruby-doc.org/core/classes/Object.html#M000604
|
26
|
-
def respond_to?(sym, include_private_data=false)
|
27
|
-
MethodDispatcher.new(self.class.described_module).respond_to?(sym) ? true : super
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def method_missing(sym, *args, &blk)
|
33
|
-
md = MethodDispatcher.new(self.class.described_module, self)
|
34
|
-
self.respond_to?(sym) ? md.call(sym, *args, &blk) : super
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../../../spec_helper"
|
2
|
-
|
3
|
-
module Spec
|
4
|
-
module Example
|
5
|
-
module AModule; end
|
6
|
-
class AClass; end
|
7
|
-
|
8
|
-
describe "With", AModule do
|
9
|
-
it "should have the described_type as 'AModule'" do
|
10
|
-
self.class.described_module.should == AModule
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "With", AClass do
|
15
|
-
it "should have the described_module as nil" do
|
16
|
-
self.class.described_module.should be_nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../../../spec_helper"
|
2
|
-
|
3
|
-
module Spec
|
4
|
-
module Example
|
5
|
-
module AModuleAutomaticallyIncluded
|
6
|
-
def call_method
|
7
|
-
@method_called = true
|
8
|
-
return "a string"
|
9
|
-
end
|
10
|
-
|
11
|
-
def method_called?
|
12
|
-
@method_called ? true : false
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "Including modules in an example group" do
|
17
|
-
describe AModuleAutomaticallyIncluded do
|
18
|
-
before :each do
|
19
|
-
Kernel.stub!(:warn)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should return the correct values" do
|
23
|
-
self.method_called?.should be_false
|
24
|
-
self.call_method.should eql("a string")
|
25
|
-
self.method_called?.should be_true
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should respond_to? the methods from the module" do
|
29
|
-
self.should respond_to(:method_called?)
|
30
|
-
self.should respond_to(:call_method)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should not respond_to? methods which do not come from the module (or are in Spec::ExampleGroup)" do
|
34
|
-
self.should_not respond_to(:adsfadfadadf_a_method_which_does_not_exist)
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should respond_to? a method in Spec::ExampleGroup" do
|
38
|
-
self.should respond_to(:describe)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should issue a warning with Kernel.warn" do
|
42
|
-
Kernel.should_receive(:warn)
|
43
|
-
self.call_method
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should issue a warning when the example calls the method which is automatically included" do
|
47
|
-
Kernel.should_receive(:warn).with("Modules will no longer be automatically included in RSpec version 1.1.4. Called from #{__FILE__}:#{__LINE__+1}")
|
48
|
-
self.method_called?
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should issue a warning with the correct file and line numbers" do
|
52
|
-
Kernel.should_receive(:warn).with("Modules will no longer be automatically included in RSpec version 1.1.4. Called from #{__FILE__}:#{__LINE__+1}")
|
53
|
-
self.method_called?
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe AModuleAutomaticallyIncluded, "which is also manually included" do
|
58
|
-
include AModuleAutomaticallyIncluded
|
59
|
-
|
60
|
-
before :each do
|
61
|
-
Kernel.stub!(:warn)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should respond to the methods since it is included" do
|
65
|
-
self.should respond_to(:method_called?)
|
66
|
-
self.should respond_to(:call_method)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should not issue a warning, since the module is manually included" do
|
70
|
-
Kernel.should_not_receive(:warn)
|
71
|
-
self.method_called?
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|