summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/guards
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 15:56:09 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 15:56:09 +0000
commit49a864ad902c7e819f2464f1001e9719a9af6cb5 (patch)
tree3b084371c3dfc8cb6eda885094b9470014c8e48b /spec/mspec/spec/guards
parent3efe410dd0812a3781b9f75a52d67a632009b2d2 (diff)
Update to ruby/mspec@5bd9409
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/mspec/spec/guards')
-rw-r--r--spec/mspec/spec/guards/guard_spec.rb7
-rw-r--r--spec/mspec/spec/guards/support_spec.rb23
2 files changed, 5 insertions, 25 deletions
diff --git a/spec/mspec/spec/guards/guard_spec.rb b/spec/mspec/spec/guards/guard_spec.rb
index f2828dd4ad..5c3dae4b3f 100644
--- a/spec/mspec/spec/guards/guard_spec.rb
+++ b/spec/mspec/spec/guards/guard_spec.rb
@@ -4,12 +4,7 @@ require 'rbconfig'
describe SpecGuard, ".ruby_version" do
before :each do
- @ruby_version = Object.const_get :RUBY_VERSION
- Object.const_set :RUBY_VERSION, "8.2.3"
- end
-
- after :each do
- Object.const_set :RUBY_VERSION, @ruby_version
+ stub_const "RUBY_VERSION", "8.2.3"
end
it "returns the full version for :full" do
diff --git a/spec/mspec/spec/guards/support_spec.rb b/spec/mspec/spec/guards/support_spec.rb
index f899ad02f6..38414abebd 100644
--- a/spec/mspec/spec/guards/support_spec.rb
+++ b/spec/mspec/spec/guards/support_spec.rb
@@ -2,27 +2,12 @@ require 'spec_helper'
require 'mspec/guards'
describe Object, "#not_supported_on" do
- before :all do
- @verbose = $VERBOSE
- $VERBOSE = nil
- @ruby_engine = Object.const_get :RUBY_ENGINE if Object.const_defined? :RUBY_ENGINE
- end
-
- after :all do
- $VERBOSE = @verbose
- if @ruby_engine
- Object.const_set :RUBY_ENGINE, @ruby_engine
- else
- Object.send :remove_const, :RUBY_ENGINE
- end
- end
-
before :each do
ScratchPad.clear
end
it "raises an Exception when passed :ruby" do
- Object.const_set :RUBY_ENGINE, "jruby"
+ stub_const "RUBY_ENGINE", "jruby"
lambda {
not_supported_on(:ruby) { ScratchPad.record :yield }
}.should raise_error(Exception)
@@ -30,19 +15,19 @@ describe Object, "#not_supported_on" do
end
it "does not yield when #implementation? returns true" do
- Object.const_set :RUBY_ENGINE, "jruby"
+ stub_const "RUBY_ENGINE", "jruby"
not_supported_on(:jruby) { ScratchPad.record :yield }
ScratchPad.recorded.should_not == :yield
end
it "yields when #standard? returns true" do
- Object.const_set :RUBY_ENGINE, "ruby"
+ stub_const "RUBY_ENGINE", "ruby"
not_supported_on(:rubinius) { ScratchPad.record :yield }
ScratchPad.recorded.should == :yield
end
it "yields when #implementation? returns false" do
- Object.const_set :RUBY_ENGINE, "jruby"
+ stub_const "RUBY_ENGINE", "jruby"
not_supported_on(:rubinius) { ScratchPad.record :yield }
ScratchPad.recorded.should == :yield
end