From c22cd5579cef04948d68131f1b1b9b9ee63b84fa Mon Sep 17 00:00:00 2001 From: thiago Date: Tue, 28 Oct 2014 15:38:55 -0200 Subject: [PATCH] Fish test environment --- .gitignore | 1 + .rspec | 2 +- Gemfile | 1 + lib/omniauth/remote_user.rb | 2 +- spec/omniauth/strategies/remote_user_spec.rb | 20 +++++++++++++++++++- spec/spec_helper.rb | 10 ++++------ 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index c59904b..fa6b6cd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ test/tmp test/version_tmp tmp *.swp +coverage/ diff --git a/.rspec b/.rspec index e7f148c..b71bde1 100644 --- a/.rspec +++ b/.rspec @@ -1 +1 @@ ---collor +-c diff --git a/Gemfile b/Gemfile index 442d364..47c900e 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,7 @@ group :development, :test do gem 'rspec' gem 'rake' gem 'coveralls' + gem 'rack-test' end gemspec diff --git a/lib/omniauth/remote_user.rb b/lib/omniauth/remote_user.rb index 1acbc1a..067a86c 100644 --- a/lib/omniauth/remote_user.rb +++ b/lib/omniauth/remote_user.rb @@ -1,4 +1,4 @@ -require 'omniauth/core' +require 'omniauth' module Omniauth module Stratagies diff --git a/spec/omniauth/strategies/remote_user_spec.rb b/spec/omniauth/strategies/remote_user_spec.rb index d499145..975f956 100644 --- a/spec/omniauth/strategies/remote_user_spec.rb +++ b/spec/omniauth/strategies/remote_user_spec.rb @@ -1 +1,19 @@ -remote_user_spec.rb +require 'spec_helper' + +describe 'Test Strategy Remote_User' do + let(:app) do + Rack::Builder.new do |b| + b.use Rack::Session::Cookie, :secret => 'abc123' + b.use OmniAuth::Strategies::RemoteUser, :fields => [:name, :email], :uid_field => :name + b.run lambda { |_env| [200, {}, ['Not Found']] } + end.to_app + end + + context 'request phase' do + before(:each) { get '/user/auth/env' } + it 'displays a form' do + expect(last_response.status).to eq(200) + end + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 30f9935..f88fc56 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,10 +9,11 @@ if RUBY_VERSION >= '1.9' end require 'rubygems' require 'bundler' +require 'rack/test' require 'rspec' -require 'racktest' -require 'omniatuh' -require 'omniatuh/test' +require 'rack/test' +require 'omniauth' +require 'omniauth/test' Bundler.setup :default, :development, :test @@ -21,7 +22,4 @@ require 'omniauth/remote_user' RSpec.configure do |config| config.include Rack::Test::Methods - config.expect_with rspec do |configuration| - configuration.sintax = :expect - end end -- libgit2 0.21.2