diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-14 15:56:09 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-14 15:56:09 +0000 |
commit | 49a864ad902c7e819f2464f1001e9719a9af6cb5 (patch) | |
tree | 3b084371c3dfc8cb6eda885094b9470014c8e48b /spec/mspec/spec/matchers | |
parent | 3efe410dd0812a3781b9f75a52d67a632009b2d2 (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')
-rw-r--r-- | spec/mspec/spec/matchers/be_kind_of_spec.rb | 4 | ||||
-rw-r--r-- | spec/mspec/spec/matchers/have_class_variable_spec.rb | 23 | ||||
-rw-r--r-- | spec/mspec/spec/matchers/have_instance_variable_spec.rb | 23 |
3 files changed, 13 insertions, 37 deletions
diff --git a/spec/mspec/spec/matchers/be_kind_of_spec.rb b/spec/mspec/spec/matchers/be_kind_of_spec.rb index 554ae6aa82..7c4a59f7b9 100644 --- a/spec/mspec/spec/matchers/be_kind_of_spec.rb +++ b/spec/mspec/spec/matchers/be_kind_of_spec.rb @@ -4,8 +4,8 @@ require 'mspec/matchers' describe BeKindOfMatcher do it "matches when actual is a kind_of? expected" do - BeKindOfMatcher.new(Integer).matches?(1).should == true - BeKindOfMatcher.new(Fixnum).matches?(2).should == true + BeKindOfMatcher.new(Numeric).matches?(1).should == true + BeKindOfMatcher.new(Integer).matches?(2).should == true BeKindOfMatcher.new(Regexp).matches?(/m/).should == true end 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 diff --git a/spec/mspec/spec/matchers/have_instance_variable_spec.rb b/spec/mspec/spec/matchers/have_instance_variable_spec.rb index ababb38bc7..4122c6551b 100644 --- a/spec/mspec/spec/matchers/have_instance_variable_spec.rb +++ b/spec/mspec/spec/matchers/have_instance_variable_spec.rb @@ -2,9 +2,12 @@ require 'spec_helper' require 'mspec/expectations/expectations' require 'mspec/matchers' -shared_examples_for "have_instance_variable, on all Ruby versions" do - after :all do - Object.const_set :RUBY_VERSION, @ruby_version +describe HaveInstanceVariableMatcher do + before :each do + @object = Object.new + def @object.instance_variables + [:@foo] + end end it "matches when object has the instance variable, given as string" do @@ -45,17 +48,3 @@ shared_examples_for "have_instance_variable, on all Ruby versions" do ] end end - -describe HaveInstanceVariableMatcher, "on RUBY_VERSION >= 1.9" do - before :all do - @ruby_version = Object.const_get :RUBY_VERSION - Object.const_set :RUBY_VERSION, '1.9.0' - - @object = Object.new - def @object.instance_variables - [:@foo] - end - end - - it_should_behave_like "have_instance_variable, on all Ruby versions" -end |