Skip to content

Commit 4aeb34f

Browse files
committed
Added test for Tempfiles
1 parent f30227f commit 4aeb34f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/fcm_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require "spec_helper"
2+
require 'tempfile'
23

34
describe FCM do
45
let(:project_name) { 'test-project' }
@@ -75,6 +76,14 @@
7576
it 'can be an IO object' do
7677
fcm = FCM.new(StringIO.new('hey'))
7778
expect(fcm.__send__(:json_key).class).to eq(StringIO)
79+
80+
temp_file = Tempfile.new('hello_world.json')
81+
temp_file.write(json_credentials)
82+
fcm_with_temp_file = FCM.new(temp_file)
83+
84+
expect { fcm_with_temp_file.__send__(:json_key) }.not_to raise_error(creds_error)
85+
temp_file.close
86+
temp_file.unlink
7887
end
7988

8089
it 'raises an error when passed a non IO-like object' do

0 commit comments

Comments
 (0)