Sha256: c215053bebc98a3553de03c54a0d93591a6dc5c7e859632fb85c127c3dddccde

Contents?: true

Size: 804 Bytes

Versions: 21

Compression:

Stored size: 804 Bytes

Contents

require 'test_helper'

class <%= sessions_class_name %>ControllerTest < ActionController::TestCase
  context "new action" do
    should "render new template" do
      get :new
      assert_template 'new'
    end
  end
  
  context "create action" do
    should "render new template when authentication is invalid" do
      <%= user_class_name %>.stubs(:authenticate).returns(nil)
      post :create
      assert_template 'new'
      assert_nil session['<%= user_singular_name %>_id']
    end
    
    should "redirect when authentication is valid" do
      <%= user_class_name %>.stubs(:authenticate).returns(<%= user_class_name %>.first)
      post :create
      assert_redirected_to root_url
      assert_equal <%= user_class_name %>.first.id, session['<%= user_singular_name %>_id']
    end
  end
end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
intinno-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
polly-nifty-generators-0.2.3 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
rubycs-nifty-generators-compass-0.0.1 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.2.6 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.2.7 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.2.8 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.2.9 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.0 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.1 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.2 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.3 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.4 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.5 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.6 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.7 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
twilson63-nifty-generators-0.3.8 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
nifty-generators-0.2.4 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
nifty-generators-0.2.2 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
nifty-generators-0.2.1 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb