aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mspec/spec/matchers/have_class_variable_spec.rb
diff options
context:
space:
mode:
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