Updated RubySpec source to 55122684.
[rbx.git] / spec / frozen / 1.8 / core / file / lchmod_spec.rb
blobc08302de8bc82f96f0868d7ebc9f660dca328209
1 require File.dirname(__FILE__) + '/../../spec_helper'
3 describe "File.lchmod" do
4   platform_is_not :os => [:linux, :windows, :openbsd] do
5     before :each do
6       @fname = tmp('file_chmod_test')
7       @lname = @fname + '.lnk'
8       File.delete @fname rescue nil
9       File.delete @lname rescue nil
10       File.open(@fname, 'w') { |f| f.write "rubinius" }
11       File.symlink @fname, @lname
12     end
13     
14     after :each do
15       File.delete @fname if File.exist? @fname
16       File.delete @lname if File.exist? @lname
17     end
18     
19     it "changes the file mode of the link and not of the file" do
20       File.chmod(0222, @lname).should  == 1
21       File.lchmod(0755, @lname).should == 1
22       
23       File.lstat(@lname).executable?.should == true
24       File.lstat(@lname).readable?.should   == true
25       File.lstat(@lname).writable?.should   == true
26   
27       File.stat(@lname).executable?.should == false
28       File.stat(@lname).readable?.should   == false
29       File.stat(@lname).writable?.should   == true
30     end
31   end
32 end