1describe :file_readable_real, shared: true do 2 before :each do 3 @file = tmp('i_exist') 4 end 5 6 after :each do 7 rm_r @file 8 end 9 10 it "returns true if named file is readable by the real user id of the process, otherwise false" do 11 File.open(@file,'w') { @object.send(@method, @file).should == true } 12 end 13 14 it "accepts an object that has a #to_path method" do 15 File.open(@file,'w') { @object.send(@method, mock_to_path(@file)).should == true } 16 end 17end 18 19describe :file_readable_real_missing, shared: true do 20 it "returns false if the file does not exist" do 21 @object.send(@method, 'fake_file').should == false 22 end 23end 24