Skip to content

Commit

Permalink
Merge pull request #124 from projecthydra/scm123
Browse files Browse the repository at this point in the history
Fixing dropbox integration
  • Loading branch information
jcoyne committed May 27, 2016
2 parents 5906cd5 + fba20a1 commit 7223ae9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/browse_everything_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def auth_link
@auth_link ||= if provider.present?
link, data = provider.auth_link
session["#{provider_name}_data"] = data
"#{link}&state=#{provider.key}"
link
else
nil
end
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/vcr_cassettes/dropbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
http_interactions:
- request:
method: post
uri: https://DropboxAppKey:DropboxAppSecret@api.dropbox.com/1/oauth2/token
uri: https://api.dropbox.com/1/oauth2/token
body:
encoding: UTF-8
string: grant_type=authorization_code&code=FakeDropboxAuthorizationCodeABCDEFG&redirect_uri=http%3A%2F%2Fbrowse.example.edu%2Fbrowse%2Fconnect
Expand Down
22 changes: 22 additions & 0 deletions spec/helper/browse_everything_controller_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require File.expand_path('../../spec_helper',__FILE__)

include BrowserConfigHelper

describe BrowseEverythingController, type: :controller do
before(:all) { stub_configuration }
after(:all) { unstub_configuration }

let(:helper_context) {controller.view_context}
let(:browser) { BrowseEverything::Browser.new(url_options) }
let(:provider) { browser.providers['dropbox'] }

before do
allow(controller).to receive(:provider).and_return(provider)
end
describe "auth_link" do
subject {helper_context.auth_link}
it "has a single state" do
expect(subject.scan(/state/).length).to eq 1
end
end
end
1 change: 1 addition & 0 deletions spec/unit/dropbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
context "#auth_link" do
specify { subject.auth_link[0].should start_with('https://www.dropbox.com/1/oauth2/authorize') }
specify { subject.auth_link[0].should include('browse%2Fconnect') }
specify { subject.auth_link[0].should include('state') }
end

it "should authorize" do
Expand Down

0 comments on commit 7223ae9

Please sign in to comment.