Sha256: ee46fda85a599fb91439ff7c722f7dd97a31ed6d1f66c73296cdc829b3817f64

Contents?: true

Size: 656 Bytes

Versions: 12

Compression:

Stored size: 656 Bytes

Contents

# -*- encoding : utf-8 -*-
module OmniauthLoginTestHelper
  def current_user
    @current_user ||= Factory.create(:user)
  end

  def login!
    session[:user_id] = current_user.id
  end
end

RSpec.configure do |config|
  config.include OmniauthLoginTestHelper, :type => :controller
  config.include OmniauthLoginTestHelper, :type => :helper
end

shared_examples_for "authentication_required_action" do
  context "not logged in" do
    before do
      http_basic_login!
      request.env["HTTP_REFERER"] = '/back'
      do_action 
    end
    it { should redirect_to("/back") }
    it { flash[:notice].should == "VocĂȘ precisa estar logado..." }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pah-0.0.12 lib/pah/files/spec/support/omniauth.rb
pah-0.0.11 lib/pah/files/spec/support/omniauth.rb
pah-0.0.10 lib/pah/files/spec/support/omniauth.rb
pah-0.0.9 lib/pah/files/spec/support/omniauth.rb
pah-0.0.8 lib/pah/files/spec/support/omniauth.rb
pah-0.0.7 lib/pah/files/spec/support/omniauth.rb
pah-0.0.6 lib/pah/files/spec/support/omniauth.rb
pah-0.0.5 lib/pah/files/spec/support/omniauth.rb
pah-0.0.4 lib/pah/files/spec/support/omniauth.rb
pah-0.0.3 lib/pah/files/spec/support/omniauth.rb
pah-0.0.2 lib/pah/files/spec/support/omniauth.rb
pah-0.0.1 lib/pah/files/spec/support/omniauth.rb