Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix specs on 1.9

- Conditionalized ruby-debug dependency in Gemfile.
- MatchYAMLMatcher also needs to clean trailing whitespace on
  `---` lines.
- DateTime offset must be a Rational on 1.9.
- instance_eval(&lambda {}) raises ArgumentError on 1.9.
- YAML == Psych on 1.9, so don't test it for NameMap.
  • Loading branch information...
commit 62292dc535924fa2c07e2095dc8ac1f1666a5047 1 parent e4b4aa7
@jfirebaugh jfirebaugh authored
View
3  Gemfile
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in mspec.gemspec
gemspec
+
+gem 'ruby-debug', :platform => :ruby_18
+gem 'ruby-debug19', :platform => :ruby_19, :require => 'ruby-debug'
View
4 lib/mspec/matchers/match_yaml.rb
@@ -10,7 +10,7 @@ def initialize(expected)
def matches?(actual)
@actual = actual
- clean_yaml(@actual) == @expected
+ clean_yaml(@actual) == clean_yaml(@expected)
end
def failure_message
@@ -24,7 +24,7 @@ def negative_failure_message
protected
def clean_yaml(yaml)
- yaml.gsub(/([^-])\s+\n/, "\\1\n")
+ yaml.gsub(/([^-]|^---)\s+\n/, "\\1\n")
end
def valid_yaml?(obj)
View
1  mspec.gemspec
@@ -34,5 +34,4 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "rake", "~> 0.9"
gem.add_development_dependency "rspec", "~> 2.8"
- gem.add_development_dependency "ruby-debug", "~> 0.10"
end
View
4 spec/helpers/datetime_spec.rb
@@ -38,7 +38,7 @@
end
it "returns a DateTime instance with the specified offset value" do
- d = new_datetime :offset => 3
- d.offset.should == 3
+ d = new_datetime :offset => Rational(3,24)
+ d.offset.should == Rational(3,24)
end
end
View
46 spec/runner/context_spec.rb
@@ -9,7 +9,7 @@
describe ContextState, "#describe" do
before :each do
@state = ContextState.new "C#m"
- @proc = lambda { ScratchPad.record :a }
+ @proc = lambda {|*| ScratchPad.record :a }
ScratchPad.clear
end
@@ -90,7 +90,7 @@
describe ContextState, "#it" do
before :each do
@state = ContextState.new ""
- @proc = lambda { }
+ @proc = lambda {|*| }
@ex = ExampleState.new("", "", &@proc)
end
@@ -129,7 +129,7 @@
describe ContextState, "#before" do
before :each do
@state = ContextState.new ""
- @proc = lambda { }
+ @proc = lambda {|*| }
end
it "records the block for :each" do
@@ -146,7 +146,7 @@
describe ContextState, "#after" do
before :each do
@state = ContextState.new ""
- @proc = lambda { }
+ @proc = lambda {|*| }
end
it "records the block for :each" do
@@ -162,9 +162,9 @@
describe ContextState, "#pre" do
before :each do
- @a = lambda { }
- @b = lambda { }
- @c = lambda { }
+ @a = lambda {|*| }
+ @b = lambda {|*| }
+ @c = lambda {|*| }
parent = ContextState.new ""
parent.before(:each, &@c)
@@ -189,9 +189,9 @@
describe ContextState, "#post" do
before :each do
- @a = lambda { }
- @b = lambda { }
- @c = lambda { }
+ @a = lambda {|*| }
+ @b = lambda {|*| }
+ @c = lambda {|*| }
parent = ContextState.new ""
parent.after(:each, &@c)
@@ -217,9 +217,9 @@
describe ContextState, "#protect" do
before :each do
ScratchPad.record []
- @a = lambda { ScratchPad << :a }
- @b = lambda { ScratchPad << :b }
- @c = lambda { raise Exception, "Fail!" }
+ @a = lambda {|*| ScratchPad << :a }
+ @b = lambda {|*| ScratchPad << :b }
+ @c = lambda {|*| raise Exception, "Fail!" }
end
it "returns true and does execute any blocks if check and MSpec.mode?(:pretend) are true" do
@@ -374,8 +374,8 @@
@state = ContextState.new ""
@state.describe { }
- @a = lambda { ScratchPad << :a }
- @b = lambda { ScratchPad << :b }
+ @a = lambda {|*| ScratchPad << :a }
+ @b = lambda {|*| ScratchPad << :b }
ScratchPad.record []
end
@@ -658,8 +658,8 @@ def example.example(state, spec)
@state = ContextState.new ""
@state.describe { }
- @a = lambda { ScratchPad << :a }
- @b = lambda { ScratchPad << :b }
+ @a = lambda {|*| ScratchPad << :a }
+ @b = lambda {|*| ScratchPad << :b }
ScratchPad.record []
@state.before(:all) { raise Exception, "Fail!" }
@@ -718,8 +718,8 @@ def example.example(state, spec)
@state = ContextState.new ""
@state.describe { }
- @a = lambda { ScratchPad << :a }
- @b = lambda { ScratchPad << :b }
+ @a = lambda {|*| ScratchPad << :a }
+ @b = lambda {|*| ScratchPad << :b }
ScratchPad.record []
@state.before(:each) { raise Exception, "Fail!" }
@@ -815,8 +815,8 @@ def example.example(state, spec)
@state = ContextState.new ""
@state.describe { }
- @a = lambda { ScratchPad << :a }
- @b = lambda { ScratchPad << :b }
+ @a = lambda {|*| ScratchPad << :a }
+ @b = lambda {|*| ScratchPad << :b }
ScratchPad.record []
end
@@ -921,8 +921,8 @@ def example.example(state, spec)
MSpec.stub!(:retrieve_shared).and_return(@shared)
@state = ContextState.new "Top level"
- @a = lambda { }
- @b = lambda { }
+ @a = lambda {|*| }
+ @b = lambda {|*| }
end
it "raises an Exception if unable to find the shared ContextState" do
View
1  spec/utils/name_map_spec.rb
@@ -74,7 +74,6 @@ def n; end
DTracer
NameMap
OptionParser
- YAML
]
excluded.each do |const|
Please sign in to comment.
Something went wrong with that request. Please try again.