Sha256: da8f38e58146a802c766f720c0d62652589314d2cb2492aa0b5680356ab2b08d

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

require 'test_helper'

class <%= session_plural_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

6 entries across 6 versions & 1 rubygems

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