summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/matchers/have_class_variable_spec.rb
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/matchers/have_class_variable_spec.rb
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/matchers/have_class_variable_spec.rb')
-rw-r--r--spec/mspec/spec/matchers/have_class_variable_spec.rb23
1 files changed, 5 insertions, 18 deletions
diff --git a/spec/mspec/spec/matchers/have_class_variable_spec.rb b/spec/mspec/spec/matchers/have_class_variable_spec.rb
index e440050056..01ba9d0f57 100644
--- a/spec/mspec/spec/matchers/have_class_variable_spec.rb
+++ b/spec/mspec/spec/matchers/have_class_variable_spec.rb
@@ -2,13 +2,13 @@ require 'spec_helper'
require 'mspec/expectations/expectations'
require 'mspec/matchers'
-class IVarModMock; end
-
-shared_examples_for "have_class_variable, on all Ruby versions" do
- after :all do
- Object.const_set :RUBY_VERSION, @ruby_version
+class IVarModMock
+ def self.class_variables
+ [:@foo]
end
+end
+describe HaveClassVariableMatcher, "on RUBY_VERSION >= 1.9" do
it "matches when mod has the class variable, given as string" do
matcher = HaveClassVariableMatcher.new('@foo')
matcher.matches?(IVarModMock).should be_true
@@ -47,16 +47,3 @@ shared_examples_for "have_class_variable, on all Ruby versions" do
]
end
end
-
-describe HaveClassVariableMatcher, "on RUBY_VERSION >= 1.9" do
- before :all do
- @ruby_version = Object.const_get :RUBY_VERSION
- Object.const_set :RUBY_VERSION, '1.9.0'
-
- def IVarModMock.class_variables
- [:@foo]
- end
- end
-
- it_should_behave_like "have_class_variable, on all Ruby versions"
-end