Sha256: 6090bf7c696c768b5c9c8d9e132ed6b4c72941b4e22fe129862cea2705e1cb30

Contents?: true

Size: 1.58 KB

Versions: 4

Compression:

Stored size: 1.58 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/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

4 entries across 4 versions & 1 rubygems

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