Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix FakeFS::File.size? #161

Closed
wants to merge 4 commits into from

2 participants

@tovodeverett

The documentation for FileTest::size? in both Ruby 1.8.7 and 1.9.3 indicates that it should return the size of the file (not true) if the file is not zero-length. I modified the test suite and the implementation for FakeFS::File.size? to match the documented behavior.

Again, only merge the most recent commit.

tovodeverett added some commits
@tovodeverett tovodeverett Updating Gemfile so I can run tests. 3ea9f69
@tovodeverett tovodeverett Merge remote-tracking branch 'upstream/master' so I can work on more
features!
077f9e6
@tovodeverett tovodeverett Ran bundle update. 831a613
@tovodeverett tovodeverett Fixed both File.size? and the test for such to match the documented
behavior for both Ruby 1.8.7 and 1.9.3, which is to return nil if
the file is missing or is a zer-length file, but is to otherwise
return the actual size (not true as fakefs used to return).
b2feab3
@smtlaissezfaire
Collaborator

Merged in e1388f7. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 26, 2012
  1. @tovodeverett
Commits on Dec 3, 2012
  1. @tovodeverett
  2. @tovodeverett

    Ran bundle update.

    tovodeverett authored
  3. @tovodeverett

    Fixed both File.size? and the test for such to match the documented

    tovodeverett authored
    behavior for both Ruby 1.8.7 and 1.9.3, which is to return nil if
    the file is missing or is a zer-length file, but is to otherwise
    return the actual size (not true as fakefs used to return).
This page is out of date. Refresh to see the latest.
View
1  Gemfile
@@ -4,4 +4,5 @@ group :development do
gem 'rspec'
gem 'jeweler'
gem 'rdiscount'
+ gem 'minitest'
end
View
6 Gemfile.lock
@@ -9,7 +9,8 @@ GEM
rake
rdoc
json (1.7.5)
- rake (10.0.0)
+ minitest (4.3.2)
+ rake (10.0.2)
rdiscount (1.6.8)
rdoc (3.12)
json (~> 1.4)
@@ -17,7 +18,7 @@ GEM
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
- rspec-core (2.12.0)
+ rspec-core (2.12.1)
rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
@@ -27,5 +28,6 @@ PLATFORMS
DEPENDENCIES
jeweler
+ minitest
rdiscount
rspec
View
2  lib/fakefs/file.rb
@@ -94,7 +94,7 @@ def self.size(path)
def self.size?(path)
if exists?(path) && !size(path).zero?
- true
+ size(path)
else
nil
end
View
2  test/fakefs_test.rb
@@ -480,7 +480,7 @@ def test_can_check_if_file_has_size?
File.open(path, 'w') do |f|
f << 'Yada Yada'
end
- assert File.size?(path)
+ assert_equal 9, File.size?(path)
assert_nil File.size?("other.txt")
end
Something went wrong with that request. Please try again.