spec/omniauth/strategies/auth0_spec.rb in omniauth-auth0-1.2.0 vs spec/omniauth/strategies/auth0_spec.rb in omniauth-auth0-1.3.0
- old
+ new
@@ -20,11 +20,11 @@
after do
OmniAuth.config.test_mode = false
end
subject do
- OmniAuth::Strategies::Auth0.new(app,
+ OmniAuth::Strategies::Auth0.new(app,
"client_id", "client_secret", "tenny.auth0.com:3000").tap do |strategy|
strategy.stub(:request) { @request }
end
end
@@ -41,21 +41,27 @@
it "uses the correct token_url" do
subject.options.client_options.token_url.
should == "https://tenny.auth0.com:3000/oauth/token"
end
+
+ it "should raise an ArgumentError error if no namespace passed" do
+ expect {
+ OmniAuth::Strategies::Auth0.new(app, "client_id", "client_secret")
+ }.to raise_error(ArgumentError)
+ end
end
context "request phase" do
before(:each){ get '/auth/auth0' }
it "authenticate" do
expect(last_response.status).to eq(200)
end
it "authorize params" do
- subject.stub(:request) { double('Request', {:params => {
+ subject.stub(:request) { double('Request', {:params => {
"connection" => "google-oauth2", "redirect_uri" => "redirect_uri" }, :env => {}}) }
subject.authorize_params.include?("connection").should == true
subject.authorize_params.include?("state").should == true
subject.authorize_params.include?("redirect_uri").should == true
end
@@ -126,20 +132,21 @@
@access_token = double('OAuth2::AccessToken')
@access_token.stub(:token)
@access_token.stub(:expires?)
@access_token.stub(:expires_at)
@access_token.stub(:refresh_token)
+ @access_token.stub(:params)
subject.stub(:access_token) { @access_token }
end
it 'returns a Hash' do
subject.credentials.should be_a(Hash)
end
-
+
it 'returns the token' do
- @access_token.stub(:token) {
+ @access_token.stub(:token) {
{
- :access_token => "OTqSFa9zrh0VRGAZHH4QPJISCoynRwSy9FocUazuaU950EVcISsJo3pST11iTCiI",
+ :access_token => "OTqSFa9zrh0VRGAZHH4QPJISCoynRwSy9FocUazuaU950EVcISsJo3pST11iTCiI",
:token_type => "bearer"
} }
subject.credentials['token'][:access_token].should eq('OTqSFa9zrh0VRGAZHH4QPJISCoynRwSy9FocUazuaU950EVcISsJo3pST11iTCiI')
subject.credentials['token'][:token_type].should eq('bearer')
end
\ No newline at end of file