diff options
Diffstat (limited to 'spec/ruby/core/env')
-rw-r--r-- | spec/ruby/core/env/delete_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/env/except_spec.rb | 44 | ||||
-rw-r--r-- | spec/ruby/core/env/index_spec.rb | 14 | ||||
-rw-r--r-- | spec/ruby/core/env/indexes_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/core/env/indices_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/core/env/to_a_spec.rb | 5 |
6 files changed, 28 insertions, 45 deletions
diff --git a/spec/ruby/core/env/delete_spec.rb b/spec/ruby/core/env/delete_spec.rb index 5e7891f74d..3d69e4b022 100644 --- a/spec/ruby/core/env/delete_spec.rb +++ b/spec/ruby/core/env/delete_spec.rb @@ -30,11 +30,9 @@ describe "ENV.delete" do ScratchPad.recorded.should == "foo" end - ruby_version_is "3.0" do - it "returns the result of given block if the named environment variable does not exist" do - ENV.delete("foo") - ENV.delete("foo") { |name| "bar" }.should == "bar" - end + it "returns the result of given block if the named environment variable does not exist" do + ENV.delete("foo") + ENV.delete("foo") { |name| "bar" }.should == "bar" end it "does not evaluate the block if the environment variable exists" do diff --git a/spec/ruby/core/env/except_spec.rb b/spec/ruby/core/env/except_spec.rb index cfe5865abe..fb8f3b7536 100644 --- a/spec/ruby/core/env/except_spec.rb +++ b/spec/ruby/core/env/except_spec.rb @@ -1,36 +1,34 @@ require_relative 'spec_helper' require_relative 'shared/to_hash' -ruby_version_is "3.0" do - describe "ENV.except" do - before do - @orig_hash = ENV.to_hash - end +describe "ENV.except" do + before do + @orig_hash = ENV.to_hash + end - after do - ENV.replace @orig_hash - end + after do + ENV.replace @orig_hash + end - # Testing the method without arguments is covered via - it_behaves_like :env_to_hash, :except + # Testing the method without arguments is covered via + it_behaves_like :env_to_hash, :except - it "returns a hash without the requested subset" do - ENV.clear + it "returns a hash without the requested subset" do + ENV.clear - ENV['one'] = '1' - ENV['two'] = '2' - ENV['three'] = '3' + ENV['one'] = '1' + ENV['two'] = '2' + ENV['three'] = '3' - ENV.except('one', 'three').should == { 'two' => '2' } - end + ENV.except('one', 'three').should == { 'two' => '2' } + end - it "ignores keys not present in the original hash" do - ENV.clear + it "ignores keys not present in the original hash" do + ENV.clear - ENV['one'] = '1' - ENV['two'] = '2' + ENV['one'] = '1' + ENV['two'] = '2' - ENV.except('one', 'three').should == { 'two' => '2' } - end + ENV.except('one', 'three').should == { 'two' => '2' } end end diff --git a/spec/ruby/core/env/index_spec.rb b/spec/ruby/core/env/index_spec.rb deleted file mode 100644 index 301a66ab4e..0000000000 --- a/spec/ruby/core/env/index_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'shared/key' - -ruby_version_is ''...'3.0' do - describe "ENV.index" do - it_behaves_like :env_key, :index - - it "warns about deprecation" do - -> do - ENV.index("foo") - end.should complain(/warning: ENV.index is deprecated; use ENV.key/) - end - end -end diff --git a/spec/ruby/core/env/indexes_spec.rb b/spec/ruby/core/env/indexes_spec.rb deleted file mode 100644 index e724feaa39..0000000000 --- a/spec/ruby/core/env/indexes_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../../spec_helper' diff --git a/spec/ruby/core/env/indices_spec.rb b/spec/ruby/core/env/indices_spec.rb deleted file mode 100644 index e724feaa39..0000000000 --- a/spec/ruby/core/env/indices_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../../spec_helper' diff --git a/spec/ruby/core/env/to_a_spec.rb b/spec/ruby/core/env/to_a_spec.rb index 39e3877b48..2b1649281f 100644 --- a/spec/ruby/core/env/to_a_spec.rb +++ b/spec/ruby/core/env/to_a_spec.rb @@ -6,7 +6,10 @@ describe "ENV.to_a" do a = ENV.to_a a.is_a?(Array).should == true a.size.should == ENV.size - ENV.each_pair { |k, v| a.should include([k, v])} + a.each { |k,v| ENV[k].should == v } + + a.first.should.is_a?(Array) + a.first.size.should == 2 end it "returns the entries in the locale encoding" do |