summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/tempfile
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/library/tempfile')
-rw-r--r--spec/rubyspec/library/tempfile/_close_spec.rb21
-rw-r--r--spec/rubyspec/library/tempfile/callback_spec.rb6
-rw-r--r--spec/rubyspec/library/tempfile/close_spec.rb57
-rw-r--r--spec/rubyspec/library/tempfile/delete_spec.rb7
-rw-r--r--spec/rubyspec/library/tempfile/initialize_spec.rb41
-rw-r--r--spec/rubyspec/library/tempfile/length_spec.rb7
-rw-r--r--spec/rubyspec/library/tempfile/open_spec.rb82
-rw-r--r--spec/rubyspec/library/tempfile/path_spec.rb26
-rw-r--r--spec/rubyspec/library/tempfile/shared/length.rb21
-rw-r--r--spec/rubyspec/library/tempfile/shared/unlink.rb12
-rw-r--r--spec/rubyspec/library/tempfile/size_spec.rb7
-rw-r--r--spec/rubyspec/library/tempfile/unlink_spec.rb7
12 files changed, 0 insertions, 294 deletions
diff --git a/spec/rubyspec/library/tempfile/_close_spec.rb b/spec/rubyspec/library/tempfile/_close_spec.rb
deleted file mode 100644
index d91a3e1adc..0000000000
--- a/spec/rubyspec/library/tempfile/_close_spec.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#_close" do
- before :each do
- @tempfile = Tempfile.new("specs")
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "is protected" do
- Tempfile.should have_protected_instance_method(:_close)
- end
-
- it "closes self" do
- @tempfile.send(:_close)
- @tempfile.closed?.should be_true
- end
-end
diff --git a/spec/rubyspec/library/tempfile/callback_spec.rb b/spec/rubyspec/library/tempfile/callback_spec.rb
deleted file mode 100644
index 045252fec3..0000000000
--- a/spec/rubyspec/library/tempfile/callback_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile.callback" do
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/rubyspec/library/tempfile/close_spec.rb b/spec/rubyspec/library/tempfile/close_spec.rb
deleted file mode 100644
index aa776b840c..0000000000
--- a/spec/rubyspec/library/tempfile/close_spec.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#close when passed no argument or [false]" do
- before :each do
- @tempfile = Tempfile.new("specs", tmp(""))
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "closes self" do
- @tempfile.close
- @tempfile.closed?.should be_true
- end
-
- it "does not unlink self" do
- path = @tempfile.path
- @tempfile.close
- File.exist?(path).should be_true
- end
-end
-
-describe "Tempfile#close when passed [true]" do
- before :each do
- @tempfile = Tempfile.new("specs", tmp(""))
- end
-
- it "closes self" do
- @tempfile.close(true)
- @tempfile.closed?.should be_true
- end
-
- it "unlinks self" do
- path = @tempfile.path
- @tempfile.close(true)
- File.exist?(path).should be_false
- end
-end
-
-describe "Tempfile#close!" do
- before :each do
- @tempfile = Tempfile.new("specs", tmp(""))
- end
-
- it "closes self" do
- @tempfile.close!
- @tempfile.closed?.should be_true
- end
-
- it "unlinks self" do
- path = @tempfile.path
- @tempfile.close!
- File.exist?(path).should be_false
- end
-end
diff --git a/spec/rubyspec/library/tempfile/delete_spec.rb b/spec/rubyspec/library/tempfile/delete_spec.rb
deleted file mode 100644
index 8e92631e62..0000000000
--- a/spec/rubyspec/library/tempfile/delete_spec.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../shared/unlink', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#delete" do
- it_behaves_like :tempfile_unlink, :delete
-end
diff --git a/spec/rubyspec/library/tempfile/initialize_spec.rb b/spec/rubyspec/library/tempfile/initialize_spec.rb
deleted file mode 100644
index 79f33e3e98..0000000000
--- a/spec/rubyspec/library/tempfile/initialize_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#initialize" do
- before :each do
- @tempfile = Tempfile.allocate
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "opens a new tempfile with the passed name in the passed directory" do
- @tempfile.send(:initialize, "basename", tmp(""))
- File.exist?(@tempfile.path).should be_true
-
- tmpdir = tmp("")
- path = @tempfile.path
-
- platform_is :windows do
- # on Windows, both types of slashes are OK,
- # but the tmp helper always uses '/'
- path.gsub!('\\', '/')
- end
-
- path[0, tmpdir.length].should == tmpdir
- path.should include("basename")
- end
-
- platform_is_not :windows do
- it "sets the permisssions on the tempfile to 0600" do
- @tempfile.send(:initialize, "basename", tmp(""))
- File.stat(@tempfile.path).mode.should == 0100600
- end
- end
-
- it "accepts encoding options" do
- @tempfile.send(:initialize, ['shiftjis', 'yml'], encoding: 'SHIFT_JIS')
- @tempfile.external_encoding.should == Encoding::Shift_JIS
- end
-end
diff --git a/spec/rubyspec/library/tempfile/length_spec.rb b/spec/rubyspec/library/tempfile/length_spec.rb
deleted file mode 100644
index b4f0a3b1d4..0000000000
--- a/spec/rubyspec/library/tempfile/length_spec.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../shared/length', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#length" do
- it_behaves_like :tempfile_length, :length
-end
diff --git a/spec/rubyspec/library/tempfile/open_spec.rb b/spec/rubyspec/library/tempfile/open_spec.rb
deleted file mode 100644
index 3ceaeec502..0000000000
--- a/spec/rubyspec/library/tempfile/open_spec.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#open" do
- before :each do
- @tempfile = Tempfile.new("specs")
- @tempfile.puts("Test!")
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "reopens self" do
- @tempfile.close
- @tempfile.open
- @tempfile.closed?.should be_false
- end
-
- it "reopens self in read and write mode and does not truncate" do
- @tempfile.open
- @tempfile.puts("Another Test!")
-
- @tempfile.open
- @tempfile.readline.should == "Another Test!\n"
- end
-end
-
-describe "Tempfile.open" do
- after :each do
- @tempfile.close! if @tempfile
- end
-
- it "returns a new, open Tempfile instance" do
- @tempfile = Tempfile.open("specs")
- # Delegation messes up .should be_an_instance_of(Tempfile)
- @tempfile.instance_of?(Tempfile).should be_true
- end
-
- it "is passed an array [base, suffix] as first argument" do
- Tempfile.open(["specs", ".tt"]) { |tempfile| @tempfile = tempfile }
- @tempfile.path.should =~ /specs.*\.tt$/
- end
-end
-
-describe "Tempfile.open when passed a block" do
- before :each do
- ScratchPad.clear
- end
-
- after :each do
- # Tempfile.open with block does not unlink
- @tempfile.close! if @tempfile
- end
-
- it "yields a new, open Tempfile instance to the block" do
- Tempfile.open("specs") do |tempfile|
- @tempfile = tempfile
- ScratchPad.record :yielded
-
- # Delegation messes up .should be_an_instance_of(Tempfile)
- tempfile.instance_of?(Tempfile).should be_true
- tempfile.closed?.should be_false
- end
-
- ScratchPad.recorded.should == :yielded
- end
-
- it "returns the value of the block" do
- value = Tempfile.open("specs") do |tempfile|
- @tempfile = tempfile
- "return"
- end
- value.should == "return"
- end
-
- it "closes the yielded Tempfile after the block" do
- Tempfile.open("specs") { |tempfile| @tempfile = tempfile }
- @tempfile.closed?.should be_true
- end
-end
-
diff --git a/spec/rubyspec/library/tempfile/path_spec.rb b/spec/rubyspec/library/tempfile/path_spec.rb
deleted file mode 100644
index f25e902872..0000000000
--- a/spec/rubyspec/library/tempfile/path_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#path" do
- before :each do
- @tempfile = Tempfile.new("specs", tmp(""))
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "returns the path to the tempfile" do
- tmpdir = tmp("")
- path = @tempfile.path
-
- platform_is :windows do
- # on Windows, both types of slashes are OK,
- # but the tmp helper always uses '/'
- path.gsub!('\\', '/')
- end
-
- path[0, tmpdir.length].should == tmpdir
- path.should include("specs")
- end
-end
diff --git a/spec/rubyspec/library/tempfile/shared/length.rb b/spec/rubyspec/library/tempfile/shared/length.rb
deleted file mode 100644
index 4d18d1f385..0000000000
--- a/spec/rubyspec/library/tempfile/shared/length.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-describe :tempfile_length, shared: true do
- before :each do
- @tempfile = Tempfile.new("specs")
- end
-
- after :each do
- @tempfile.close!
- end
-
- it "returns the size of self" do
- @tempfile.send(@method).should eql(0)
- @tempfile.print("Test!")
- @tempfile.send(@method).should eql(5)
- end
-
- it "returns the size of self even if self is closed" do
- @tempfile.print("Test!")
- @tempfile.close
- @tempfile.send(@method).should eql(5)
- end
-end
diff --git a/spec/rubyspec/library/tempfile/shared/unlink.rb b/spec/rubyspec/library/tempfile/shared/unlink.rb
deleted file mode 100644
index 2b575fd391..0000000000
--- a/spec/rubyspec/library/tempfile/shared/unlink.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-describe :tempfile_unlink, shared: true do
- before :each do
- @tempfile = Tempfile.new("specs")
- end
-
- it "unlinks self" do
- @tempfile.close
- path = @tempfile.path
- @tempfile.send(@method)
- File.exist?(path).should be_false
- end
-end
diff --git a/spec/rubyspec/library/tempfile/size_spec.rb b/spec/rubyspec/library/tempfile/size_spec.rb
deleted file mode 100644
index ac66d35906..0000000000
--- a/spec/rubyspec/library/tempfile/size_spec.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../shared/length', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#size" do
- it_behaves_like :tempfile_length, :size
-end
diff --git a/spec/rubyspec/library/tempfile/unlink_spec.rb b/spec/rubyspec/library/tempfile/unlink_spec.rb
deleted file mode 100644
index d4ef343c8d..0000000000
--- a/spec/rubyspec/library/tempfile/unlink_spec.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../shared/unlink', __FILE__)
-require 'tempfile'
-
-describe "Tempfile#unlink" do
- it_behaves_like :tempfile_unlink, :unlink
-end