Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a2ead5a40cf6
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a2db439c95ef
Choose a head ref
  • 4 commits
  • 5 files changed
  • 2 contributors

Commits on Mar 8, 2015

  1. Add File::Stat#birthtime specs

    jsyeo committed Mar 8, 2015
    Copy the full SHA
    be72e9d View commit details
  2. Copy the full SHA
    e5019a2 View commit details
  3. Copy the full SHA
    fc4fff5 View commit details
  4. Merge pull request #3350 from jsyeo/birthtime-specs

    Add birthtime specs
    Yorick Peterse committed Mar 8, 2015
    Copy the full SHA
    a2db439 View commit details
40 changes: 40 additions & 0 deletions spec/ruby/core/file/birthtime_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "File.birthtime" do
before :each do
@file = __FILE__
end

after :each do
@file = nil
end

it "returns the birth time for the named file as a Time object" do
File.birthtime(@file)
File.birthtime(@file).should be_kind_of(Time)
end

it "accepts an object that has a #to_path method" do
File.birthtime(mock_to_path(@file))
end

it "raises an Errno::ENOENT exception if the file is not found" do
lambda { File.birthtime('bogus') }.should raise_error(Errno::ENOENT)
end
end

describe "File#birthtime" do
before :each do
@file = File.open(__FILE__)
end

after :each do
@file.close
@file = nil
end

it "returns the birth time for self" do
@file.birthtime
@file.birthtime.should be_kind_of(Time)
end
end
2 changes: 1 addition & 1 deletion spec/ruby/core/file/ctime_spec.rb
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
@file = File.open(__FILE__)
end

after:each do
after :each do
@file.close
@file = nil
end
18 changes: 18 additions & 0 deletions spec/ruby/core/file/stat/birthtime_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require File.expand_path('../../../../spec_helper', __FILE__)

describe "File::Stat#birthtime" do
before :each do
@file = tmp('i_exist')
touch(@file) { |f| f.write "rubinius" }
end

after :each do
rm_r @file
end

it "returns the birthtime of a File::Stat object" do
st = File.stat(@file)
st.birthtime.should be_kind_of(Time)
st.birthtime.should <= Time.now
end
end
4 changes: 4 additions & 0 deletions spec/tags/ruby/core/file/birthtime_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fails:File.birthtime returns the birth time for the named file as a Time object
fails:File.birthtime accepts an object that has a #to_path method
fails:File.birthtime raises an Errno::ENOENT exception if the file is not found
fails:File#birthtime returns the birth time for self
1 change: 1 addition & 0 deletions spec/tags/ruby/core/file/stat/birthtime_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:File::Stat#birthtime returns the birthtime of a File::Stat object