rspec-expectations 2.0.0.beta.8 → 2.0.0.beta.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.
Files changed (75) hide show
  1. data/README.markdown +1 -1
  2. data/Rakefile +8 -7
  3. data/Upgrade.markdown +6 -6
  4. data/VERSION +1 -1
  5. data/features/expectations/customized_message.feature +1 -1
  6. data/features/expectations/implicit_docstrings.feature +2 -2
  7. data/features/matchers/access_running_example.feature +5 -5
  8. data/features/matchers/define_diffable_matcher.feature +2 -2
  9. data/features/matchers/define_matcher.feature +14 -14
  10. data/features/matchers/define_matcher_outside_rspec.feature +2 -2
  11. data/features/matchers/define_matcher_with_fluent_interface.feature +2 -2
  12. data/features/matchers/expect_change.feature +2 -2
  13. data/features/matchers/expect_error.feature +2 -2
  14. data/lib/rspec/expectations.rb +7 -5
  15. data/lib/rspec/expectations/backward_compatibility.rb +16 -0
  16. data/lib/rspec/expectations/differ.rb +58 -0
  17. data/lib/rspec/expectations/errors.rb +1 -1
  18. data/lib/rspec/expectations/extensions/kernel.rb +4 -4
  19. data/lib/rspec/expectations/extensions/rspec/core/example_group.rb +1 -1
  20. data/lib/rspec/expectations/fail_with.rb +6 -4
  21. data/lib/rspec/expectations/handler.rb +11 -11
  22. data/lib/rspec/expectations/version.rb +1 -1
  23. data/lib/rspec/matchers.rb +7 -8
  24. data/lib/rspec/matchers/be.rb +6 -6
  25. data/lib/rspec/matchers/be_close.rb +1 -1
  26. data/lib/rspec/matchers/be_instance_of.rb +1 -1
  27. data/lib/rspec/matchers/be_kind_of.rb +1 -1
  28. data/lib/rspec/matchers/change.rb +1 -1
  29. data/lib/rspec/matchers/compatibility.rb +2 -2
  30. data/lib/rspec/matchers/dsl.rb +4 -4
  31. data/lib/rspec/matchers/eq.rb +1 -1
  32. data/lib/rspec/matchers/eql.rb +1 -1
  33. data/lib/rspec/matchers/equal.rb +1 -1
  34. data/lib/rspec/matchers/errors.rb +1 -1
  35. data/lib/rspec/matchers/exist.rb +1 -1
  36. data/lib/rspec/matchers/extensions/instance_exec.rb +1 -1
  37. data/lib/rspec/matchers/generated_descriptions.rb +1 -1
  38. data/lib/rspec/matchers/has.rb +1 -1
  39. data/lib/rspec/matchers/have.rb +1 -1
  40. data/lib/rspec/matchers/include.rb +1 -1
  41. data/lib/rspec/matchers/match.rb +1 -1
  42. data/lib/rspec/matchers/match_array.rb +3 -3
  43. data/lib/rspec/matchers/matcher.rb +13 -13
  44. data/lib/rspec/matchers/method_missing.rb +1 -1
  45. data/lib/rspec/matchers/operator_matcher.rb +4 -4
  46. data/lib/rspec/matchers/pretty.rb +1 -1
  47. data/lib/rspec/matchers/raise_error.rb +1 -1
  48. data/lib/rspec/matchers/respond_to.rb +1 -1
  49. data/lib/rspec/matchers/satisfy.rb +1 -1
  50. data/lib/rspec/matchers/throw_symbol.rb +1 -1
  51. data/rspec-expectations.gemspec +17 -14
  52. data/spec/rspec/expectations/{differs/default_spec.rb → differ_spec.rb} +4 -36
  53. data/spec/rspec/expectations/fail_with_spec.rb +6 -50
  54. data/spec/rspec/expectations/handler_spec.rb +22 -22
  55. data/spec/rspec/matchers/be_close_spec.rb +1 -1
  56. data/spec/rspec/matchers/be_instance_of_spec.rb +1 -1
  57. data/spec/rspec/matchers/be_kind_of_spec.rb +1 -1
  58. data/spec/rspec/matchers/change_spec.rb +3 -3
  59. data/spec/rspec/matchers/compatibility_spec.rb +3 -3
  60. data/spec/rspec/matchers/description_generation_spec.rb +28 -28
  61. data/spec/rspec/matchers/dsl_spec.rb +3 -3
  62. data/spec/rspec/matchers/eq_spec.rb +1 -1
  63. data/spec/rspec/matchers/eql_spec.rb +1 -1
  64. data/spec/rspec/matchers/equal_spec.rb +1 -1
  65. data/spec/rspec/matchers/exist_spec.rb +1 -1
  66. data/spec/rspec/matchers/have_spec.rb +3 -3
  67. data/spec/rspec/matchers/match_array_spec.rb +3 -0
  68. data/spec/rspec/matchers/matcher_spec.rb +25 -25
  69. data/spec/rspec/matchers/operator_matcher_spec.rb +12 -12
  70. data/spec/rspec/matchers/throw_symbol_spec.rb +1 -1
  71. data/spec/spec_helper.rb +6 -7
  72. data/spec/support/classes.rb +1 -1
  73. metadata +35 -21
  74. data/lib/rspec/expectations/differs/default.rb +0 -62
  75. data/lib/rspec/expectations/differs/load-diff-lcs.rb +0 -7
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- module Rspec
2
+ module RSpec
3
3
  module Matchers
4
4
  describe "[actual.should] be_close(expected, delta)" do
5
5
  it "matches when actual == expected" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Matchers
5
5
  [:be_an_instance_of, :be_instance_of].each do |method|
6
6
  describe "actual.should #{method}(expected)" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Matchers
5
5
  [:be_a_kind_of, :be_kind_of].each do |method|
6
6
  describe "actual.should #{method}(expected)" do
@@ -62,7 +62,7 @@ describe "should change { block }" do
62
62
  it "should warn if passed a block using do/end instead of {}" do
63
63
  expect do
64
64
  expect {}.to change do; end
65
- end.to raise_error(Rspec::Matchers::MatcherError, /block passed to should or should_not/)
65
+ end.to raise_error(RSpec::Matchers::MatcherError, /block passed to should or should_not/)
66
66
  end
67
67
 
68
68
  it "provides a #description" do
@@ -89,7 +89,7 @@ describe "should_not change { block }" do
89
89
  it "should warn if passed a block using do/end instead of {}" do
90
90
  expect do
91
91
  expect {}.to_not change do; end
92
- end.to raise_error(Rspec::Matchers::MatcherError, /block passed to should or should_not/)
92
+ end.to raise_error(RSpec::Matchers::MatcherError, /block passed to should or should_not/)
93
93
  end
94
94
  end
95
95
 
@@ -336,7 +336,7 @@ describe "should change{ block }.from(old).to(new)" do
336
336
  end
337
337
  end
338
338
 
339
- describe Rspec::Matchers::Change do
339
+ describe RSpec::Matchers::Change do
340
340
  it "should work when the receiver has implemented #send" do
341
341
  @instance = SomethingExpected.new
342
342
  @instance.some_value = "string"
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- Rspec::Matchers.define :have_public_instance_method do |method|
3
+ RSpec::Matchers.define :have_public_instance_method do |method|
4
4
  match do |klass|
5
5
  klass.public_instance_methods.any? {|m| [method, method.to_sym].include?(m)}
6
6
  end
7
7
  end
8
8
 
9
- (Rspec::Matchers.constants.sort).each do |c|
10
- if (Class === (klass = Rspec::Matchers.const_get(c)))
9
+ (RSpec::Matchers.constants.sort).each do |c|
10
+ if (Class === (klass = RSpec::Matchers.const_get(c)))
11
11
  describe klass do
12
12
  if klass.public_instance_methods.any? {|m| ['failure_message_for_should',:failure_message_for_should].include?(m)}
13
13
  describe "called with should" do
@@ -2,138 +2,138 @@ require 'spec_helper'
2
2
 
3
3
  describe "Matchers should be able to generate their own descriptions" do
4
4
  after(:each) do
5
- Rspec::Matchers.clear_generated_description
5
+ RSpec::Matchers.clear_generated_description
6
6
  end
7
7
 
8
8
  it "should == expected" do
9
9
  "this".should == "this"
10
- Rspec::Matchers.generated_description.should == "should == \"this\""
10
+ RSpec::Matchers.generated_description.should == "should == \"this\""
11
11
  end
12
12
 
13
13
  it "should not == expected" do
14
14
  "this".should_not == "that"
15
- Rspec::Matchers.generated_description.should == "should not == \"that\""
15
+ RSpec::Matchers.generated_description.should == "should not == \"that\""
16
16
  end
17
17
 
18
18
  it "should be empty (arbitrary predicate)" do
19
19
  [].should be_empty
20
- Rspec::Matchers.generated_description.should == "should be empty"
20
+ RSpec::Matchers.generated_description.should == "should be empty"
21
21
  end
22
22
 
23
23
  it "should not be empty (arbitrary predicate)" do
24
24
  [1].should_not be_empty
25
- Rspec::Matchers.generated_description.should == "should not be empty"
25
+ RSpec::Matchers.generated_description.should == "should not be empty"
26
26
  end
27
27
 
28
28
  it "should be true" do
29
29
  true.should be_true
30
- Rspec::Matchers.generated_description.should == "should be true"
30
+ RSpec::Matchers.generated_description.should == "should be true"
31
31
  end
32
32
 
33
33
  it "should be false" do
34
34
  false.should be_false
35
- Rspec::Matchers.generated_description.should == "should be false"
35
+ RSpec::Matchers.generated_description.should == "should be false"
36
36
  end
37
37
 
38
38
  it "should be nil" do
39
39
  nil.should be_nil
40
- Rspec::Matchers.generated_description.should == "should be nil"
40
+ RSpec::Matchers.generated_description.should == "should be nil"
41
41
  end
42
42
 
43
43
  it "should be > n" do
44
44
  5.should be > 3
45
- Rspec::Matchers.generated_description.should == "should be > 3"
45
+ RSpec::Matchers.generated_description.should == "should be > 3"
46
46
  end
47
47
 
48
48
  it "should be predicate arg1, arg2 and arg3" do
49
49
  5.0.should be_between(0,10)
50
- Rspec::Matchers.generated_description.should == "should be between 0 and 10"
50
+ RSpec::Matchers.generated_description.should == "should be between 0 and 10"
51
51
  end
52
52
 
53
53
  it "should equal" do
54
54
  expected = "expected"
55
55
  expected.should equal(expected)
56
- Rspec::Matchers.generated_description.should == "should equal \"expected\""
56
+ RSpec::Matchers.generated_description.should == "should equal \"expected\""
57
57
  end
58
58
 
59
59
  it "should_not equal" do
60
60
  5.should_not equal(37)
61
- Rspec::Matchers.generated_description.should == "should not equal 37"
61
+ RSpec::Matchers.generated_description.should == "should not equal 37"
62
62
  end
63
63
 
64
64
  it "should eql" do
65
65
  "string".should eql("string")
66
- Rspec::Matchers.generated_description.should == "should eql \"string\""
66
+ RSpec::Matchers.generated_description.should == "should eql \"string\""
67
67
  end
68
68
 
69
69
  it "should not eql" do
70
70
  "a".should_not eql(:a)
71
- Rspec::Matchers.generated_description.should == "should not eql :a"
71
+ RSpec::Matchers.generated_description.should == "should not eql :a"
72
72
  end
73
73
 
74
74
  it "should have_key" do
75
75
  {:a => "a"}.should have_key(:a)
76
- Rspec::Matchers.generated_description.should == "should have key :a"
76
+ RSpec::Matchers.generated_description.should == "should have key :a"
77
77
  end
78
78
 
79
79
  it "should have n items" do
80
80
  team.should have(3).players
81
- Rspec::Matchers.generated_description.should == "should have 3 players"
81
+ RSpec::Matchers.generated_description.should == "should have 3 players"
82
82
  end
83
83
 
84
84
  it "should have at least n items" do
85
85
  team.should have_at_least(2).players
86
- Rspec::Matchers.generated_description.should == "should have at least 2 players"
86
+ RSpec::Matchers.generated_description.should == "should have at least 2 players"
87
87
  end
88
88
 
89
89
  it "should have at most n items" do
90
90
  team.should have_at_most(4).players
91
- Rspec::Matchers.generated_description.should == "should have at most 4 players"
91
+ RSpec::Matchers.generated_description.should == "should have at most 4 players"
92
92
  end
93
93
 
94
94
  it "should include" do
95
95
  [1,2,3].should include(3)
96
- Rspec::Matchers.generated_description.should == "should include 3"
96
+ RSpec::Matchers.generated_description.should == "should include 3"
97
97
  end
98
98
 
99
99
  it "array.should =~ [1,2,3]" do
100
100
  [1,2,3].should =~ [1,2,3]
101
- Rspec::Matchers.generated_description.should == "should contain exactly 1, 2 and 3"
101
+ RSpec::Matchers.generated_description.should == "should contain exactly 1, 2 and 3"
102
102
  end
103
103
 
104
104
  it "should match" do
105
105
  "this string".should match(/this string/)
106
- Rspec::Matchers.generated_description.should == "should match /this string/"
106
+ RSpec::Matchers.generated_description.should == "should match /this string/"
107
107
  end
108
108
 
109
109
  it "should raise_error" do
110
110
  lambda { raise }.should raise_error
111
- Rspec::Matchers.generated_description.should == "should raise Exception"
111
+ RSpec::Matchers.generated_description.should == "should raise Exception"
112
112
  end
113
113
 
114
114
  it "should raise_error with type" do
115
115
  lambda { raise }.should raise_error(RuntimeError)
116
- Rspec::Matchers.generated_description.should == "should raise RuntimeError"
116
+ RSpec::Matchers.generated_description.should == "should raise RuntimeError"
117
117
  end
118
118
 
119
119
  it "should raise_error with type and message" do
120
120
  lambda { raise "there was an error" }.should raise_error(RuntimeError, "there was an error")
121
- Rspec::Matchers.generated_description.should == "should raise RuntimeError with \"there was an error\""
121
+ RSpec::Matchers.generated_description.should == "should raise RuntimeError with \"there was an error\""
122
122
  end
123
123
 
124
124
  it "should respond_to" do
125
125
  [].should respond_to(:insert)
126
- Rspec::Matchers.generated_description.should == "should respond to #insert"
126
+ RSpec::Matchers.generated_description.should == "should respond to #insert"
127
127
  end
128
128
 
129
129
  it "should throw symbol" do
130
130
  lambda { throw :what_a_mess }.should throw_symbol
131
- Rspec::Matchers.generated_description.should == "should throw a Symbol"
131
+ RSpec::Matchers.generated_description.should == "should throw a Symbol"
132
132
  end
133
133
 
134
134
  it "should throw symbol (with named symbol)" do
135
135
  lambda { throw :what_a_mess }.should throw_symbol(:what_a_mess)
136
- Rspec::Matchers.generated_description.should == "should throw :what_a_mess"
136
+ RSpec::Matchers.generated_description.should == "should throw :what_a_mess"
137
137
  end
138
138
 
139
139
  def team
@@ -155,6 +155,6 @@ describe "a Matcher with no description" do
155
155
 
156
156
  it "should provide a helpful message when used in a string-less example block" do
157
157
  5.should matcher
158
- Rspec::Matchers.generated_description.should =~ /When you call.*description method/m
158
+ RSpec::Matchers.generated_description.should =~ /When you call.*description method/m
159
159
  end
160
160
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Matchers
5
5
  module DSL
6
6
  describe "#define" do
@@ -9,13 +9,13 @@ module Rspec
9
9
  # more robust - that expects new to be called with a specific
10
10
  # block (lambda, proc, whatever)
11
11
  mod = Module.new
12
- mod.extend Rspec::Matchers::DSL
12
+ mod.extend RSpec::Matchers::DSL
13
13
  mod.define(:foo)
14
14
 
15
15
  obj = Object.new
16
16
  obj.extend mod
17
17
 
18
- Rspec::Matchers::Matcher.should_receive(:new).with(:foo, 3) { stub('matcher').as_null_object }
18
+ RSpec::Matchers::Matcher.should_receive(:new).with(:foo, 3) { stub('matcher').as_null_object }
19
19
 
20
20
  obj.foo(3)
21
21
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Matchers
5
5
  describe "eq" do
6
6
  it "matches when actual == expected" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Matchers
5
5
  describe "eql" do
6
6
  it "should match when actual.eql?(expected)" do
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- module Rspec
2
+ module RSpec
3
3
  module Matchers
4
4
  describe "equal" do
5
5
 
@@ -14,7 +14,7 @@ class Substance
14
14
  end
15
15
 
16
16
  class SubstanceTester
17
- include Rspec::Matchers
17
+ include RSpec::Matchers
18
18
  def initialize substance
19
19
  @substance = substance
20
20
  end
@@ -3,7 +3,7 @@ require 'stringio'
3
3
 
4
4
  share_as :HaveSpecHelper do
5
5
  def create_collection_owner_with(n)
6
- owner = Rspec::Expectations::Helper::CollectionOwner.new
6
+ owner = RSpec::Expectations::Helper::CollectionOwner.new
7
7
  (1..n).each do |number|
8
8
  owner.add_to_collection_with_length_method(number)
9
9
  owner.add_to_collection_with_size_method(number)
@@ -329,7 +329,7 @@ describe "have(n).things on an object which is not a collection nor contains one
329
329
  end
330
330
  end
331
331
 
332
- describe Rspec::Matchers::Have, "for a collection owner that implements #send" do
332
+ describe RSpec::Matchers::Have, "for a collection owner that implements #send" do
333
333
  include HaveSpecHelper
334
334
 
335
335
  before(:each) do
@@ -357,7 +357,7 @@ describe Rspec::Matchers::Have, "for a collection owner that implements #send" d
357
357
  end
358
358
  end
359
359
 
360
- module Rspec
360
+ module RSpec
361
361
  module Matchers
362
362
  describe Have do
363
363
  it "should have method_missing as private" do
@@ -1,6 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class UnsortableObject
4
+ # ruby-1.9.2 adds <=> to Object
5
+ undef_method :<=> rescue nil
6
+
4
7
  def initialize(id)
5
8
  @id = id
6
9
  end
@@ -2,12 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  class UnexpectedError < StandardError; end
4
4
 
5
- module Rspec
5
+ module RSpec
6
6
  module Matchers
7
7
  describe Matcher do
8
8
  context "without overrides" do
9
9
  before(:each) do
10
- @matcher = Rspec::Matchers::Matcher.new(:be_a_multiple_of, 3) do |multiple|
10
+ @matcher = RSpec::Matchers::Matcher.new(:be_a_multiple_of, 3) do |multiple|
11
11
  match do |actual|
12
12
  actual % multiple == 0
13
13
  end
@@ -30,22 +30,22 @@ module Rspec
30
30
  end
31
31
 
32
32
  it "is not diffable by default" do
33
- matcher = Rspec::Matchers::Matcher.new(:name) {}
33
+ matcher = RSpec::Matchers::Matcher.new(:name) {}
34
34
  matcher.should_not be_diffable
35
35
  end
36
36
 
37
37
  it "is diffable when told to be" do
38
- matcher = Rspec::Matchers::Matcher.new(:name) { diffable }
38
+ matcher = RSpec::Matchers::Matcher.new(:name) { diffable }
39
39
  matcher.should be_diffable
40
40
  end
41
41
 
42
42
  it "provides expected" do
43
- matcher = Rspec::Matchers::Matcher.new(:name, 'expected string') {}
43
+ matcher = RSpec::Matchers::Matcher.new(:name, 'expected string') {}
44
44
  matcher.expected.should == ['expected string']
45
45
  end
46
46
 
47
47
  it "provides actual" do
48
- matcher = Rspec::Matchers::Matcher.new(:name, 'expected string') do
48
+ matcher = RSpec::Matchers::Matcher.new(:name, 'expected string') do
49
49
  match {|actual|}
50
50
  end
51
51
 
@@ -56,7 +56,7 @@ module Rspec
56
56
 
57
57
  context "wrapping another expectation (should == ...)" do
58
58
  it "returns true if the wrapped expectation passes" do
59
- matcher = Rspec::Matchers::Matcher.new(:name, 'value') do |expected|
59
+ matcher = RSpec::Matchers::Matcher.new(:name, 'value') do |expected|
60
60
  match do |actual|
61
61
  actual.should == expected
62
62
  end
@@ -65,7 +65,7 @@ module Rspec
65
65
  end
66
66
 
67
67
  it "returns false if the wrapped expectation fails" do
68
- matcher = Rspec::Matchers::Matcher.new(:name, 'value') do |expected|
68
+ matcher = RSpec::Matchers::Matcher.new(:name, 'value') do |expected|
69
69
  match do |actual|
70
70
  actual.should == expected
71
71
  end
@@ -76,7 +76,7 @@ module Rspec
76
76
 
77
77
  context "with overrides" do
78
78
  before(:each) do
79
- @matcher = Rspec::Matchers::Matcher.new(:be_boolean, true) do |boolean|
79
+ @matcher = RSpec::Matchers::Matcher.new(:be_boolean, true) do |boolean|
80
80
  match do |actual|
81
81
  actual
82
82
  end
@@ -117,7 +117,7 @@ module Rspec
117
117
 
118
118
  context "#new" do
119
119
  it "passes matches? arg to match block" do
120
- matcher = Rspec::Matchers::Matcher.new(:ignore) do
120
+ matcher = RSpec::Matchers::Matcher.new(:ignore) do
121
121
  match do |actual|
122
122
  actual == 5
123
123
  end
@@ -126,7 +126,7 @@ module Rspec
126
126
  end
127
127
 
128
128
  it "exposes arg submitted through #new to matcher block" do
129
- matcher = Rspec::Matchers::Matcher.new(:ignore, 4) do |expected|
129
+ matcher = RSpec::Matchers::Matcher.new(:ignore, 4) do |expected|
130
130
  match do |actual|
131
131
  actual > expected
132
132
  end
@@ -137,7 +137,7 @@ module Rspec
137
137
 
138
138
  context "with no args" do
139
139
  before(:each) do
140
- @matcher = Rspec::Matchers::Matcher.new(:matcher_name) do
140
+ @matcher = RSpec::Matchers::Matcher.new(:matcher_name) do
141
141
  match do |actual|
142
142
  actual == 5
143
143
  end
@@ -155,7 +155,7 @@ module Rspec
155
155
 
156
156
  context "with 1 arg" do
157
157
  before(:each) do
158
- @matcher = Rspec::Matchers::Matcher.new(:matcher_name, 1) do |expected|
158
+ @matcher = RSpec::Matchers::Matcher.new(:matcher_name, 1) do |expected|
159
159
  match do |actual|
160
160
  actual == 5 && expected == 1
161
161
  end
@@ -173,7 +173,7 @@ module Rspec
173
173
 
174
174
  context "with multiple args" do
175
175
  before(:each) do
176
- @matcher = Rspec::Matchers::Matcher.new(:matcher_name, 1, 2, 3, 4) do |a,b,c,d|
176
+ @matcher = RSpec::Matchers::Matcher.new(:matcher_name, 1, 2, 3, 4) do |a,b,c,d|
177
177
  match do |sum|
178
178
  a + b + c + d == sum
179
179
  end
@@ -190,7 +190,7 @@ module Rspec
190
190
  end
191
191
 
192
192
  it "supports helper methods" do
193
- matcher = Rspec::Matchers::Matcher.new(:be_similar_to, [1,2,3]) do |sample|
193
+ matcher = RSpec::Matchers::Matcher.new(:be_similar_to, [1,2,3]) do |sample|
194
194
  match do |actual|
195
195
  similar?(sample, actual)
196
196
  end
@@ -204,7 +204,7 @@ module Rspec
204
204
  end
205
205
 
206
206
  it "supports fluent interface" do
207
- matcher = Rspec::Matchers::Matcher.new(:first_word) do
207
+ matcher = RSpec::Matchers::Matcher.new(:first_word) do
208
208
  def second_word
209
209
  self
210
210
  end
@@ -214,14 +214,14 @@ module Rspec
214
214
  end
215
215
 
216
216
  it "treats method missing normally for undeclared methods" do
217
- matcher = Rspec::Matchers::Matcher.new(:ignore) { }
217
+ matcher = RSpec::Matchers::Matcher.new(:ignore) { }
218
218
  expect { matcher.non_existent_method }.to raise_error(NoMethodError)
219
219
  end
220
220
 
221
221
  it "has access to other matchers" do
222
- matcher = Rspec::Matchers::Matcher.new(:ignore, 3) do |expected|
222
+ matcher = RSpec::Matchers::Matcher.new(:ignore, 3) do |expected|
223
223
  match do |actual|
224
- extend Rspec::Matchers
224
+ extend RSpec::Matchers
225
225
  actual.should eql(5 + expected)
226
226
  end
227
227
  end
@@ -240,7 +240,7 @@ module Rspec
240
240
  end
241
241
  let(:matcher) do
242
242
  m = mod
243
- Rspec::Matchers::Matcher.new :equal, 4 do |expected|
243
+ RSpec::Matchers::Matcher.new :equal, 4 do |expected|
244
244
  extend m
245
245
  match_unless_raises UnexpectedError do
246
246
  assert_equal expected, actual
@@ -257,7 +257,7 @@ module Rspec
257
257
 
258
258
  context "with an unexpected error" do
259
259
  let(:matcher) do
260
- Rspec::Matchers::Matcher.new :foo, :bar do |expected|
260
+ RSpec::Matchers::Matcher.new :foo, :bar do |expected|
261
261
  match_unless_raises SyntaxError do |actual|
262
262
  raise "unexpected exception"
263
263
  end
@@ -274,7 +274,7 @@ module Rspec
274
274
  end
275
275
 
276
276
  it "can define chainable methods" do
277
- matcher = Rspec::Matchers::Matcher.new(:name) do
277
+ matcher = RSpec::Matchers::Matcher.new(:name) do
278
278
  chain(:expecting) do |expected_value|
279
279
  @expected_value = expected_value
280
280
  end
@@ -291,7 +291,7 @@ module Rspec
291
291
  end
292
292
 
293
293
  it "can access methods in the running_example" do
294
- Rspec::Matchers.define(:__access_running_example) do
294
+ RSpec::Matchers.define(:__access_running_example) do
295
295
  match do |actual|
296
296
  a_method_in_the_example == "method defined in the example"
297
297
  end
@@ -300,7 +300,7 @@ module Rspec
300
300
  end
301
301
 
302
302
  it "raises NoMethodError for methods not in the running_example" do
303
- Rspec::Matchers.define(:__raise_no_method_error) do
303
+ RSpec::Matchers.define(:__raise_no_method_error) do
304
304
  match do |actual|
305
305
  a_method_not_in_the_example == "method defined in the example"
306
306
  end
@@ -308,7 +308,7 @@ module Rspec
308
308
 
309
309
  expect do
310
310
  running_example.should __raise_no_method_error
311
- end.to raise_error(/Rspec::Matchers::Matcher/)
311
+ end.to raise_error(/RSpec::Matchers::Matcher/)
312
312
  end
313
313
  end
314
314