summaryrefslogtreecommitdiff
path: root/spec/ruby/core/dir/tell_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/dir/tell_spec.rb')
-rw-r--r--spec/ruby/core/dir/tell_spec.rb35
1 files changed, 29 insertions, 6 deletions
diff --git a/spec/ruby/core/dir/tell_spec.rb b/spec/ruby/core/dir/tell_spec.rb
index fb9848153d..dcbb40438f 100644
--- a/spec/ruby/core/dir/tell_spec.rb
+++ b/spec/ruby/core/dir/tell_spec.rb
@@ -1,7 +1,7 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/common', __FILE__)
-require File.expand_path('../shared/closed', __FILE__)
-require File.expand_path('../shared/pos', __FILE__)
+require_relative '../../spec_helper'
+require_relative 'fixtures/common'
+require_relative 'shared/closed'
+require_relative 'shared/pos'
describe "Dir#tell" do
before :all do
@@ -12,7 +12,30 @@ describe "Dir#tell" do
DirSpecs.delete_mock_dirs
end
- it_behaves_like :dir_pos, :tell
-
it_behaves_like :dir_closed, :tell
+
+ before :each do
+ @dir = Dir.open DirSpecs.mock_dir
+ end
+
+ after :each do
+ @dir.close rescue nil
+ end
+
+ it "returns an Integer representing the current position in the directory" do
+ @dir.tell.should.is_a?(Integer)
+ @dir.tell.should.is_a?(Integer)
+ @dir.tell.should.is_a?(Integer)
+ end
+
+ it "returns a different Integer if moved from previous position" do
+ a = @dir.tell
+ @dir.read
+ b = @dir.tell
+
+ a.should.is_a?(Integer)
+ b.should.is_a?(Integer)
+
+ a.should_not == b
+ end
end