Sha256: 17224ef6b86ce4b9957dc55ebfbeec68a416e9f082d4eea8bf54c3d970c9bf75

Contents?: true

Size: 1.42 KB

Versions: 11

Compression:

Stored size: 1.42 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 "admin/users/edit" do
  before do
    login_and_assign(admin: true)
    assign(:user, @user = FactoryGirl.build_stubbed(:user))
  end

  it "cancel replaces [Edit User] form with user partial" do
    params[:cancel] = "true"
    render

    expect(rendered).to include("$('#user_#{@user.id}').replaceWith")
  end

  it "edit hides previously open [Edit User] and replaces it with user partial" do
    assign(:previous, previous = FactoryGirl.build_stubbed(:user))
    render

    expect(rendered).to include("user_#{previous.id}")
  end

  it "edit removes previously open [Edit User] if it's no longer available" do
    assign(:previous, previous = 41)
    render

    expect(rendered).to include(%/crm.flick('user_#{previous}', 'remove');/)
  end

  it "edit turns off highlight, hides [Create User] form, and replaces current user with [Edit User] form" do
    render

    expect(rendered).to include(%/crm.highlight_off('user_#{@user.id}');/)
    expect(rendered).to include(%/crm.hide_form('create_user')/)
    expect(rendered).to include("user_#{@user.id}")
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
fat_free_crm-0.15.2 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.16.4 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.15.1 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.16.3 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.16.2 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.16.1 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.16.0 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.15.0 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.15.0.beta.2 spec/views/admin/users/edit.js.haml_spec.rb
fat_free_crm-0.15.0.beta spec/views/admin/users/edit.js.haml_spec.rb
reduced_fat_crm-0.15.0.beta spec/views/admin/users/edit.js.haml_spec.rb