Sha256: 0bc44302cebb3bc68d581e233124066f718854ffd16ba52bcccfbffed11f08ae

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe <%= user_plural_class_name %>Controller do

  integrate_views

  describe "new action" do

    it "should render new template" do
      get :new
      response.should render_template(:new)
    end

  end

  describe "create action" do

    it "should render new template when model is invalid" do
      <%= user_class_name %>.any_instance.stubs(:valid?).returns(false)
      post :create
      response.should render_template(:new)
    end

    it "should redirect when model is valid" do
      <%= user_class_name %>.any_instance.stubs(:valid?).returns(true)
      <%= user_class_name %>.stubs(:new).returns(<%= user_plural_name %>(:one))
      post :create
      response.should redirect_to(root_url)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iain-pizza-generators-0.1.3 rails_generators/pizza_authentication/templates/tests/rspec/users_controller.rb
iain-pizza-generators-0.1.4 rails_generators/pizza_authentication/templates/tests/rspec/users_controller.rb