Source

main / spec / controllers / users_controller_spec.rb

require 'spec_helper'

describe UsersController do
  render_views

  describe "GET 'show'" do
    
    before (:each) do
      @user = FactoryGirl.create(:user)
    end
  
    it "should be successful" do
      get :show, :id => @user
      response.should be_success
    end
  
    it "should find the right user" do
      get :show, :id => @user
      assigns (:user).should == @user
    end
  end
  
  describe "GET 'new'" do
    it "should be successful" do
      get 'new'
      response.should be_success
    end
    
    it "should have the right title" do
      get 'new'
      response.should have_selector("title", :content => "Create Account")
    end
  end
end