File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 4444
4545 it "should raise same error as Patron if file is not readable for get request" do
4646 stub_request ( :get , "www.example.com" )
47- File . open ( "/tmp/read_only_file" , "w" ) do |tmpfile |
48- tmpfile . chmod ( 0400 )
49- end
50- begin
51- expect {
52- @sess . get_file ( "/" , "/tmp/read_only_file" )
53- } . to raise_error ( ArgumentError , "Unable to open specified file." )
54- ensure
55- File . unlink ( "/tmp/read_only_file" )
56- end
47+
48+ allow ( File ) . to receive ( :open ) . and_call_original
49+ allow ( File ) . to receive ( :open ) . with ( @file_path , "w" ) . and_raise ( Errno ::EACCES )
50+
51+ expect {
52+ @sess . get_file ( "/" , @file_path )
53+ } . to raise_error ( ArgumentError , "Unable to open specified file." )
54+
5755 end
5856
5957 it "should work with put_file" do
You can’t perform that action at this time.
0 commit comments