Sha256: 073accf51dc4c2a34e8b9fb5b782d04afafe45c62acd650014d0586296bdcb60

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/users/update" do
  include UsersHelper

  before do
    login_and_assign
    assign(:user, @user = current_user)
  end

  describe "no errors:" do
    it "should flip [Edit Profile] form" do
      render
      rendered.should include('crm.flip_form("edit_profile")')
    end

    it "should update Welcome, user!" do
      render
      rendered.should have_rjs("welcome_username")
    end

    it "should update actual user profile information" do
      render
      rendered.should have_rjs("profile")
    end
  end # no errors

  describe "validation errors :" do
    before do
      @user.errors.add(:first_name)
    end

    it "should redraw the [Edit Profile] form and shake it" do
      render
      rendered.should have_rjs("edit_profile") do |rjs|
        with_tag("form[class=edit_user]")
      end
      rendered.should include('$("edit_profile").visualEffect("shake"')
      rendered.should include('$("user_email").focus()')
    end

    it "should keep welcome or profile information intact" do
      render
      rendered.should_not have_rjs("welcome_username")
      rendered.should_not have_rjs("profile")
    end

  end # errors
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 spec/views/users/update.rjs_spec.rb
fat_free_crm-0.12.2 spec/views/users/update.rjs_spec.rb
fat_free_crm-0.12.1 spec/views/users/update.rjs_spec.rb
fat_free_crm-0.12.0 spec/views/users/update.rjs_spec.rb