Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adds some basic specs

  • Loading branch information...
commit 9fa9aabdd9d91274c1b3c4a42bb7d9469614b69e 1 parent 975ee52
@skorks authored
View
2  .rspec
@@ -0,0 +1,2 @@
+--color
+--format=progress
View
9 Gemfile
@@ -4,3 +4,12 @@ source "http://rubygems.org"
gemspec
gem 'omniauth-oauth', :git => 'https://github.com/intridea/omniauth-oauth.git'
+
+group :development, :test do
+ gem 'guard'
+ gem 'guard-rspec'
+ gem 'guard-bundler'
+ gem 'growl'
+ gem 'rb-fsevent'
+ gem 'multi_json'
+end
View
11 Guardfile
@@ -0,0 +1,11 @@
+guard 'rspec', :version => 2 do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
+
+guard 'bundler' do
+ watch('Gemfile')
+ watch(/^.+\.gemspec/)
+end
View
5 Rakefile
@@ -1 +1,6 @@
require 'bundler/gem_tasks'
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec)
+
+task :default => :spec
View
6 omniauth-linkedin.gemspec
@@ -16,8 +16,10 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_runtime_dependency 'omniauth-oauth', '~> 1.0.0.rc2'
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0.0'
- s.add_development_dependency 'rspec', '~> 2.6.0'
+ s.add_development_dependency 'rspec', '~> 2.7.0'
s.add_development_dependency 'rake'
+ s.add_development_dependency 'webmock'
+ s.add_development_dependency 'rack-test'
end
View
39 spec/omniauth/strategies/linkedin_spec.rb
@@ -0,0 +1,39 @@
+require 'spec_helper'
+
+describe "OmniAuth::Strategies::LinkedIn" do
+ subject do
+ OmniAuth::Strategies::LinkedIn.new(nil, @options || {})
+ end
+
+ it 'should add a camelization for itself' do
+ OmniAuth::Utils.camelize('linkedin').should == 'LinkedIn'
+ end
+
+ context 'client options' do
+ it 'has correct LinkedIn site' do
+ subject.options.client_options.site.should eq('https://api.linkedin.com')
+ end
+
+ it 'has correct request token path' do
+ subject.options.client_options.request_token_path.should eq('/uas/oauth/requestToken')
+ end
+
+ it 'has correct access token path' do
+ subject.options.client_options.access_token_path.should eq('/uas/oauth/accessToken')
+ end
+
+ it 'has correct authorize url' do
+ subject.options.client_options.authorize_url.should eq('https://www.linkedin.com/uas/oauth/authenticate')
+ end
+ end
+
+ context '#uid' do
+ before :each do
+ subject.stub(:raw_info) { { 'id' => '123' } }
+ end
+
+ it 'returns the id from raw_info' do
+ subject.uid.should eq('123')
+ end
+ end
+end
View
14 spec/spec_helper.rb
@@ -0,0 +1,14 @@
+$:.unshift File.expand_path('..', __FILE__)
+$:.unshift File.expand_path('../../lib', __FILE__)
+
+require 'rspec'
+require 'rack/test'
+require 'webmock/rspec'
+require 'omniauth'
+require 'omniauth-linkedin'
+
+RSpec.configure do |config|
+ config.include WebMock::API
+ config.include Rack::Test::Methods
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
+end
Please sign in to comment.
Something went wrong with that request. Please try again.