mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
Use IO#closed? instead of temp file count to test file closure in spec
Hopefully this takes care of the spurious spec failures described in issue #163.
This commit is contained in:
parent
24273a2423
commit
5cb0da475e
1 changed files with 1 additions and 6 deletions
|
@ -25,16 +25,11 @@ describe RestClient::Request do
|
|||
|
||||
it 'closes payload if not nil' do
|
||||
test_file = File.new(File.join( File.dirname(File.expand_path(__FILE__)), 'master_shake.jpg'))
|
||||
initial_count = tmp_count
|
||||
|
||||
stub_request(:post, 'http://some/resource').with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate'}).to_return(:body => 'foo', :status => 200)
|
||||
RestClient::Request.execute(:url => 'http://some/resource', :method => :post, :payload => {:file => test_file})
|
||||
|
||||
tmp_count.should == initial_count
|
||||
test_file.closed?.should be_true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def tmp_count
|
||||
Dir.glob(Dir::tmpdir + "/*").size
|
||||
end
|
Loading…
Reference in a new issue