Sha256: 71f39ebe7782bade4abd1599d31ce5375bef21e9831582fb64e53e7abe01a5eb

Contents?: true

Size: 730 Bytes

Versions: 25

Compression:

Stored size: 730 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
      assert_equal assigns['<%= user_singular_name %>'].id, session['<%= user_singular_name %>_id']
    end
  end
end

Version data entries

25 entries across 25 versions & 6 rubygems

Version Path
iain-pizza-generators-0.1.1 rails_generators/pizza_authentication/templates/tests/shoulda/users_controller.rb
iain-pizza-generators-0.1.2 rails_generators/pizza_authentication/templates/tests/shoulda/users_controller.rb
iain-pizza-generators-0.1.3 rails_generators/pizza_authentication/templates/tests/shoulda/users_controller.rb
iain-pizza-generators-0.1.4 rails_generators/pizza_authentication/templates/tests/shoulda/users_controller.rb
intinno-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
polly-nifty-generators-0.2.3 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
rubycs-nifty-generators-compass-0.0.1 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.2.5 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.2.6 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.2.7 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.2.8 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.2.9 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.0 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.1 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.2 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.3 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.4 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.5 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.6 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
twilson63-nifty-generators-0.3.7 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb