Sha256: 479049df5752fd101c9ca6404adaefa25651cb13d7641afc5d470ec92cfdbe91

Contents?: true

Size: 829 Bytes

Versions: 6

Compression:

Stored size: 829 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe <%= session_plural_class_name %>Controller do
  fixtures :all
  render_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

6 entries across 6 versions & 1 rubygems

Version Path
zoo-generators-0.1.5 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb
zoo-generators-0.1.4 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb
zoo-generators-0.1.3 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb
zoo-generators-0.1.2 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb
zoo-generators-0.1.1 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb
zoo-generators-0.1.0 lib/generators/zoo/authentication/templates/tests/rspec/sessions_controller.rb