Sha256: a5f2f6f87f4a7da454e06c06863bf3b75fd1f31fd47d442840c0e043f4428c0f

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 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 "/"
    <%- unless options[:authlogic] -%>
      assert_equal assigns['<%= user_singular_name %>'].id, session['<%= user_singular_name %>_id']
    <%- end -%>
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
niftier-generators-0.1.2 lib/generators/niftier/authentication/templates/tests/shoulda/users_controller.rb
niftier-generators-0.1.1 lib/generators/niftier/authentication/templates/tests/shoulda/users_controller.rb
niftier-generators-0.1.0 lib/generators/niftier/authentication/templates/tests/shoulda/users_controller.rb
corntrace-nifty-generators-0.4.1 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
corntrace-nifty-generators-0.4.0 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
nifty-generators-0.4.0 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb