Skip to content

Commit

Permalink
Add test for app_access_token refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
kangkyu committed Nov 6, 2017
1 parent b26eeb1 commit 6ca8dff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/funky/connections/base.rb
Expand Up @@ -52,7 +52,7 @@ def self.json_for(uri, max_retries = 3)

def self.uri_with_query(uri, query={})
return nil if uri.nil?
new_query = URI.decode_www_form(uri.query).to_h.merge(query)
new_query = URI.decode_www_form(uri.query).to_h.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}.merge(query)
uri.query = URI.encode_www_form(new_query)
uri
end
Expand Down
12 changes: 12 additions & 0 deletions spec/pages/find_spec.rb
Expand Up @@ -36,5 +36,17 @@

it { expect { page }.to raise_error(Funky::ContentNotFound) }
end

context 'with invalid app access token' do
before { Funky::Connection::API.instance_variable_set :@app_access_token, 'invalid-token' }

context 'given an existing page ID' do
let(:page_id) { existing_page_id }

specify 'does not raise error by refreshing' do
expect{ page }.not_to raise_error
end
end
end
end
end

0 comments on commit 6ca8dff

Please sign in to comment.