Sha256: 4e73623ffe7d80f598a26c827a91e140fee005509001b2e753eeb3dacf29a264

Contents?: true

Size: 1.06 KB

Versions: 44

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe ProfilesController, "routes" do
  it { should route(:get, "/profile/edit").to(:action => :edit) }
  it { should route(:put, "/profile").to(:action => :update) }
end

describe ProfilesController, "edit", :as => :user do
  before { get :edit }
  it { should respond_with(:success) }
  it { should assign_to(:user).with(user) }
end

describe ProfilesController, "valid update", :as => :user do
  let(:attributes) { 'attributes' }

  before do
    user.stubs(:update_attributes => true)
    put :update, :user => attributes
  end

  it { should set_the_flash.to(/has been updated/) }

  it "redirects to the user" do
    should redirect_to(edit_profile_url)
  end

  it "updates the user" do
    user.should have_received(:update_attributes).with(attributes)
  end
end

describe ProfilesController, "invalid update", :as => :user do
  before do
    user.stubs(:update_attributes => false)
    get :update, :user => { :email => "" }
  end

  it { should_not set_the_flash }
  it { should render_template(:edit) }
  it { should assign_to(:user).with(user) }
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
saucy-0.1.4 spec/controllers/profiles_controller_spec.rb
saucy-0.1.3 spec/controllers/profiles_controller_spec.rb
saucy-0.1.2 spec/controllers/profiles_controller_spec.rb
saucy-0.1.1 spec/controllers/profiles_controller_spec.rb