Sha256: 29b8b8c4b0b3350559718d46a4d669eb8f1d97b6c7822b273fcfb6198190660b

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

require 'spec_helper'

describe DummyController do
  before(:each) do
    @redis = Redis.new
    @redis.flushdb

    Beta.config do |config|
      config.redis = @redis
      config.namespace = 'gem'
      config.redirect_url = 'http://www.site.com/not-authorized'
      config.uid = 'uid'
      config.environments = ["test"]
    end
  end

  it 'should redirect if user is not whitelisted' do
    get 'index'

    response.should be_redirect
    response.should redirect_to('http://www.site.com/not-authorized')
    response.cookies.should be_empty
  end

  it 'should not redirect if user is whitelisted' do
    Beta.redis.sadd("#{Beta.namespace}:#{::Rails.env}:beta", 35)
    get 'index'

    response.should be_ok
    response.cookies.should_not be_empty
    response.cookies["#{Beta.namespace}-beta"].should_not be_nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beta-0.0.3 spec/controllers/dummy_controller_spec.rb