Sha256: 66c94957f1d461897cd86c29887b39725db7be30b7bd4ce235695564d36d1212

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 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 'spec_helper'

describe "admin/users/update" do
  before do
    login_and_assign(admin: true)
    assign(:user, @user = FactoryGirl.build_stubbed(:user))
  end

  describe "no errors:" do
    it "replaces [Edit User] form with user partial and highlights it" do
      render

      expect(rendered).to include("user_#{@user.id}")
      expect(rendered).to include(%/$('#user_#{@user.id}').effect("highlight"/)
    end
  end # no errors

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

    it "redraws [Edit User] form and shakes it" do
      render

      expect(rendered).to include("user_#{@user.id}")
      expect(rendered).to include(%/$('#user_#{@user.id}').effect("shake"/)
      expect(rendered).to include(%/$('#user_username').focus()/)
    end
  end # errors
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fat_free_crm-0.15.0.beta.2 spec/views/admin/users/update.js.haml_spec.rb
fat_free_crm-0.15.0.beta spec/views/admin/users/update.js.haml_spec.rb
reduced_fat_crm-0.15.0.beta spec/views/admin/users/update.js.haml_spec.rb