Sha256: d9e7c7e7cc6825a8584ee3aca5f658cb857252aee2a34a2b6671a4c9aeab55f8

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 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.create(:user))
  end

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

    rendered.should have_rjs("user_#{@user.id}") do |rjs|
      with_tag("li[id=user_#{@user.id}]")
    end
  end

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

    rendered.should have_rjs("user_#{previous.id}") do |rjs|
      with_tag("li[id=user_#{previous.id}]")
    end
  end

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

    rendered.should include(%Q/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

    rendered.should include(%Q/crm.highlight_off("user_#{@user.id}");/)
    rendered.should include('crm.hide_form("create_user")')
    rendered.should have_rjs("user_#{@user.id}") do |rjs|
      with_tag("form[class=edit_user]")
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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