Sha256: 9d45a2b295126a29d3fff24dcdcf1e5fd89387b8e7fd17d4b8fe12037b775d64

Contents?: true

Size: 784 Bytes

Versions: 5

Compression:

Stored size: 784 Bytes

Contents

require 'test_helper'

class <%= user_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 model is invalid" do
      <%= user_class_name %>.any_instance.stubs(:valid?).returns(false)
      post :create
      assert_template 'new'
    end
  
    should "redirect when model is valid" do
      <%= user_class_name %>.any_instance.stubs(:valid?).returns(true)
      post :create
      assert_redirected_to root_url
    <%- unless options.authlogic? -%>
      assert_equal assigns['<%= user_singular_name %>'].id, session['<%= user_singular_name %>_id']
    <%- end -%>
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
very_nifty_generators-0.2.1 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
very_nifty_generators-0.2.0 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
very_nifty_generators-0.1.2 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
very_nifty_generators-0.1.1 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
very_nifty_generators-0.1.0 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb