Sha256: d5b9c4553a54a69819fef2948c26bacf6646bcdc18eb9f5065d122286df0a998

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

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

describe "/users/change_password" do
  include UsersHelper

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

  describe "no errors:" do
    it "should flip [Change Password] form" do
      render

      rendered.should_not have_rjs("user_#{@user.id}")
      rendered.should include('crm.flip_form("change_password"')
      rendered.should include('crm.set_title("change_password", "My Profile")')
    end

    it "should show flash message" do
      render

      rendered.should have_rjs("flash")
      rendered.should include('crm.flash("notice")')
    end
  end # no errors

  describe "validation errors:" do
    it "should redraw the [Change Password] form and shake it" do
      @user.errors.add(:current_password, "error")
      render

      rendered.should have_rjs("change_password") do |rjs|
        with_tag("form[class=edit_user]")
      end
      rendered.should include('$("change_password").visualEffect("shake"')
      rendered.should include('$("current_password").focus()')
    end

    it "should redraw the [Change Password] form and correctly set focus" do
      @user.errors.add(:user_password, "error")
      render

      rendered.should include('$("user_password").focus()')
    end

  end # errors
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fat_free_crm-0.11.4 spec/views/users/change_password.rjs_spec.rb