Sha256: 13f10bec26d7866afc555baed52acfd14858ef9378823f716c9aa61b9d4ed1c2

Contents?: true

Size: 830 Bytes

Versions: 31

Compression:

Stored size: 830 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
 
describe <%= sessions_class_name %>Controller do
  fixtures :all
  integrate_views
  
  it "new action should render new template" do
    get :new
    response.should render_template(:new)
  end
  
  it "create action should render new template when authentication is invalid" do
    <%= user_class_name %>.stubs(:authenticate).returns(nil)
    post :create
    response.should render_template(:new)
    session['<%= user_singular_name %>_id'].should be_nil
  end
  
  it "create action should redirect when authentication is valid" do
    <%= user_class_name %>.stubs(:authenticate).returns(<%= user_class_name %>.first)
    post :create
    response.should redirect_to(root_url)
    session['<%= user_singular_name %>_id'].should == <%= user_class_name %>.first.id
  end
end

Version data entries

31 entries across 31 versions & 8 rubygems

Version Path
PeterCoulton-rotten-generators-0.7.0 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
PeterCoulton-rotten-generators-0.7.12 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
intinno-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
polly-nifty-generators-0.2.3 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.0 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.2 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.3 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.4 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.5 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.6 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-generators-0.9.7 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rotten-rotten-generators-0.7.12 rails_generators/rotten_authentication/templates/tests/rspec/sessions_controller.rb
rubycs-nifty-generators-compass-0.0.1 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.2.6 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.2.7 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.2.8 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.2.9 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.3.0 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
twilson63-nifty-generators-0.3.1 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb