Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated MSpec source to 41fd9186.

  • Loading branch information...
commit 290b7ae7f19da858cdc78ed0e83356f89fe25d19 1 parent 3794477
@jfirebaugh jfirebaugh authored
View
3  mspec/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
18 mspec/Gemfile.lock
@@ -6,12 +6,15 @@ PATH
GEM
remote: https://rubygems.org/
specs:
+ archive-tar-minitar (0.5.2)
columnize (0.3.6)
diff-lcs (1.1.3)
linecache (0.46)
rbx-require-relative (> 0.0.4)
+ linecache19 (0.5.12)
+ ruby_core_source (>= 0.1.4)
rake (0.9.2.2)
- rbx-require-relative (0.0.5)
+ rbx-require-relative (0.0.9)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
@@ -25,6 +28,16 @@ GEM
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
+ ruby-debug-base19 (0.11.25)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
PLATFORMS
ruby
@@ -33,4 +46,5 @@ DEPENDENCIES
mspec!
rake (~> 0.9)
rspec (~> 2.8)
- ruby-debug (~> 0.10)
+ ruby-debug
+ ruby-debug19
View
9 mspec/lib/mspec/helpers/frozen_object_error_class.rb
@@ -0,0 +1,9 @@
+class Object
+
+ # Returns the class of the exception raised when attempting to modify
+ # a frozen object: either TypeError or RuntimeError, depending on the version.
+ #
+ def frozen_object_error_class
+ SpecVersion.new(RUBY_VERSION) < "1.9" ? TypeError : RuntimeError
+ end
+end
View
5 mspec/lib/mspec/matchers/be_computed_by.rb
@@ -10,7 +10,8 @@ def matches?(array)
@value = line.pop
@arguments = line
@arguments += @args
- return false unless @receiver.send(@method, *@arguments) == @value
+ @actual = @receiver.send(@method, *@arguments)
+ return false unless @actual == @value
end
return true
@@ -25,7 +26,7 @@ def method_call
end
def failure_message
- ["Expected #{@value.inspect}", "to be computed by #{method_call}"]
+ ["Expected #{@value.inspect}", "to be computed by #{method_call} (computed #{@actual.inspect} instead)"]
end
end
View
4 mspec/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/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 mspec/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
17 mspec/spec/helpers/frozen_object_error_class.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+require 'mspec/guards'
+require 'mspec/helpers'
+
+describe "#frozen_object_error_class" do
+ ruby_version_is ''...'1.9' do
+ it "is TypeError" do
+ frozen_object_error_class.should == TypeError
+ end
+ end
+
+ ruby_version_is '1.9' do
+ it "is RuntimeError" do
+ frozen_object_error_class.should == RuntimeError
+ end
+ end
+end
View
2  mspec/spec/matchers/be_computed_by_spec.rb
@@ -37,6 +37,6 @@
[91, "Z" ] ]
matcher = BeComputedByMatcher.new(:chr)
matcher.matches?(array)
- matcher.failure_message.should == ["Expected \"Z\"", "to be computed by 91.chr"]
+ matcher.failure_message.should == ["Expected \"Z\"", "to be computed by 91.chr (computed \"[\" instead)"]
end
end
View
7 mspec/spec/matchers/raise_error_spec.rb
@@ -34,7 +34,12 @@ class UnexpectedException < Exception; end
end
it "does not match when the proc raises the expected exception with an unexpected message" do
- proc = Proc.new { raise UnexpectedException, "unexpected" }
+ proc = Proc.new { raise ExpectedException, "unexpected" }
+ RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
+ end
+
+ it "does not match when the proc does not raise an exception" do
+ proc = Proc.new {}
RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
end
View
46 mspec/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  mspec/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.