diff options
Diffstat (limited to 'spec/ruby/core/env/shared')
| -rw-r--r-- | spec/ruby/core/env/shared/each.rb | 12 | ||||
| -rw-r--r-- | spec/ruby/core/env/shared/include.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/core/env/shared/select.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/core/env/shared/store.rb | 14 | ||||
| -rw-r--r-- | spec/ruby/core/env/shared/to_hash.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/core/env/shared/update.rb | 24 |
6 files changed, 29 insertions, 31 deletions
diff --git a/spec/ruby/core/env/shared/each.rb b/spec/ruby/core/env/shared/each.rb index d901b854c4..0661ca924c 100644 --- a/spec/ruby/core/env/shared/each.rb +++ b/spec/ruby/core/env/shared/each.rb @@ -8,9 +8,9 @@ describe :env_each, shared: true do ENV.clear ENV["foo"] = "bar" ENV["baz"] = "boo" - ENV.send(@method) { |k, v| e << [k, v] }.should equal(ENV) - e.should include(["foo", "bar"]) - e.should include(["baz", "boo"]) + ENV.send(@method) { |k, v| e << [k, v] }.should.equal?(ENV) + e.should.include?(["foo", "bar"]) + e.should.include?(["baz", "boo"]) ensure ENV.replace orig end @@ -18,7 +18,7 @@ describe :env_each, shared: true do it "returns an Enumerator if called without a block" do enum = ENV.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) enum.each do |name, value| ENV[name].should == value end @@ -55,9 +55,9 @@ describe :env_each, shared: true do Encoding.default_internal = internal = Encoding::IBM437 ENV.send(@method) do |key, value| - key.encoding.should equal(internal) + key.encoding.should.equal?(internal) if value.ascii_only? - value.encoding.should equal(internal) + value.encoding.should.equal?(internal) end end end diff --git a/spec/ruby/core/env/shared/include.rb b/spec/ruby/core/env/shared/include.rb index 70aa555301..ceca02e3eb 100644 --- a/spec/ruby/core/env/shared/include.rb +++ b/spec/ruby/core/env/shared/include.rb @@ -25,6 +25,6 @@ describe :env_include, shared: true do end it "raises TypeError if the argument is not a String and does not respond to #to_str" do - -> { ENV.send(@method, Object.new) }.should raise_error(TypeError, "no implicit conversion of Object into String") + -> { ENV.send(@method, Object.new) }.should.raise(TypeError, "no implicit conversion of Object into String") end end diff --git a/spec/ruby/core/env/shared/select.rb b/spec/ruby/core/env/shared/select.rb index 75ba112a32..8ec648a637 100644 --- a/spec/ruby/core/env/shared/select.rb +++ b/spec/ruby/core/env/shared/select.rb @@ -14,7 +14,7 @@ describe :env_select, shared: true do it "returns an Enumerator when no block is given" do enum = ENV.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) end it "selects via the enumerator" do @@ -49,7 +49,7 @@ describe :env_select!, shared: true do end it "returns an Enumerator if called without a block" do - ENV.send(@method).should be_an_instance_of(Enumerator) + ENV.send(@method).should.instance_of?(Enumerator) end it "selects via the enumerator" do diff --git a/spec/ruby/core/env/shared/store.rb b/spec/ruby/core/env/shared/store.rb index d6265c66a5..388208a8ac 100644 --- a/spec/ruby/core/env/shared/store.rb +++ b/spec/ruby/core/env/shared/store.rb @@ -14,13 +14,13 @@ describe :env_store, shared: true do it "returns the value" do value = "bar" - ENV.send(@method, "foo", value).should equal(value) + ENV.send(@method, "foo", value).should.equal?(value) end it "deletes the environment variable when the value is nil" do ENV["foo"] = "bar" ENV.send(@method, "foo", nil) - ENV.key?("foo").should be_false + ENV.key?("foo").should == false end it "coerces the key argument with #to_str" do @@ -38,23 +38,23 @@ describe :env_store, shared: true do end it "raises TypeError when the key is not coercible to String" do - -> { ENV.send(@method, Object.new, "bar") }.should raise_error(TypeError, "no implicit conversion of Object into String") + -> { ENV.send(@method, Object.new, "bar") }.should.raise(TypeError, "no implicit conversion of Object into String") end it "raises TypeError when the value is not coercible to String" do - -> { ENV.send(@method, "foo", Object.new) }.should raise_error(TypeError, "no implicit conversion of Object into String") + -> { ENV.send(@method, "foo", Object.new) }.should.raise(TypeError, "no implicit conversion of Object into String") end it "raises Errno::EINVAL when the key contains the '=' character" do - -> { ENV.send(@method, "foo=", "bar") }.should raise_error(Errno::EINVAL) + -> { ENV.send(@method, "foo=", "bar") }.should.raise(Errno::EINVAL) end it "raises Errno::EINVAL when the key is an empty string" do - -> { ENV.send(@method, "", "bar") }.should raise_error(Errno::EINVAL) + -> { ENV.send(@method, "", "bar") }.should.raise(Errno::EINVAL) end it "does nothing when the key is not a valid environment variable key and the value is nil" do ENV.send(@method, "foo=", nil) - ENV.key?("foo=").should be_false + ENV.key?("foo=").should == false end end diff --git a/spec/ruby/core/env/shared/to_hash.rb b/spec/ruby/core/env/shared/to_hash.rb index a0d4d7ce69..7868690c38 100644 --- a/spec/ruby/core/env/shared/to_hash.rb +++ b/spec/ruby/core/env/shared/to_hash.rb @@ -10,7 +10,7 @@ describe :env_to_hash, shared: true do it "returns the ENV as a hash" do ENV["foo"] = "bar" h = ENV.send(@method) - h.should be_an_instance_of(Hash) + h.should.instance_of?(Hash) h["foo"].should == "bar" end @@ -24,7 +24,7 @@ describe :env_to_hash, shared: true do it "duplicates the ENV when converting to a Hash" do h = ENV.send(@method) - h.should_not equal ENV + h.should_not.equal? ENV h.size.should == ENV.size h.each_pair do |k, v| ENV[k].should == v diff --git a/spec/ruby/core/env/shared/update.rb b/spec/ruby/core/env/shared/update.rb index 7d4799955b..112cc2505d 100644 --- a/spec/ruby/core/env/shared/update.rb +++ b/spec/ruby/core/env/shared/update.rb @@ -10,21 +10,19 @@ describe :env_update, shared: true do end it "adds the parameter hash to ENV, returning ENV" do - ENV.send(@method, "foo" => "0", "bar" => "1").should equal(ENV) + ENV.send(@method, "foo" => "0", "bar" => "1").should.equal?(ENV) ENV["foo"].should == "0" ENV["bar"].should == "1" end - ruby_version_is "3.2" do - it "adds the multiple parameter hashes to ENV, returning ENV" do - ENV.send(@method, {"foo" => "multi1"}, {"bar" => "multi2"}).should equal(ENV) - ENV["foo"].should == "multi1" - ENV["bar"].should == "multi2" - end + it "adds the multiple parameter hashes to ENV, returning ENV" do + ENV.send(@method, {"foo" => "multi1"}, {"bar" => "multi2"}).should.equal?(ENV) + ENV["foo"].should == "multi1" + ENV["bar"].should == "multi2" end it "returns ENV when no block given" do - ENV.send(@method, {"foo" => "0", "bar" => "1"}).should equal(ENV) + ENV.send(@method, {"foo" => "0", "bar" => "1"}).should.equal?(ENV) end it "yields key, the old value and the new value when replacing an entry" do @@ -65,23 +63,23 @@ describe :env_update, shared: true do end it "returns ENV when block given" do - ENV.send(@method, {"foo" => "0", "bar" => "1"}){}.should equal(ENV) + ENV.send(@method, {"foo" => "0", "bar" => "1"}){}.should.equal?(ENV) end it "raises TypeError when a name is not coercible to String" do - -> { ENV.send @method, Object.new => "0" }.should raise_error(TypeError, "no implicit conversion of Object into String") + -> { ENV.send @method, Object.new => "0" }.should.raise(TypeError, "no implicit conversion of Object into String") end it "raises TypeError when a value is not coercible to String" do - -> { ENV.send @method, "foo" => Object.new }.should raise_error(TypeError, "no implicit conversion of Object into String") + -> { ENV.send @method, "foo" => Object.new }.should.raise(TypeError, "no implicit conversion of Object into String") end it "raises Errno::EINVAL when a name contains the '=' character" do - -> { ENV.send(@method, "foo=" => "bar") }.should raise_error(Errno::EINVAL) + -> { ENV.send(@method, "foo=" => "bar") }.should.raise(Errno::EINVAL) end it "raises Errno::EINVAL when a name is an empty string" do - -> { ENV.send(@method, "" => "bar") }.should raise_error(Errno::EINVAL) + -> { ENV.send(@method, "" => "bar") }.should.raise(Errno::EINVAL) end it "updates good data preceding an error" do |
