Sha256: af5af7287da84cc499e8e147b0c202306b07e3458e821975b8ef2182de31b372

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

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

describe "/contacts/new" do
  include ContactsHelper

  before do
    login_and_assign
    @account = FactoryGirl.create(:account)
    assign(:contact, Contact.new(:user => current_user))
    assign(:users, [ current_user ])
    assign(:account, @account)
    assign(:accounts, [ @account ])
  end

  it "should toggle empty message div if it exists" do
    render

    rendered.should include('crm.flick("empty", "toggle")')
  end

  describe "new contact" do
    it "should render [new] template into :create_contact div" do
      params[:cancel] = nil
      render

      rendered.should have_rjs("create_contact") do |rjs|
        with_tag("form[class=new_contact]")
      end
    end
  end

  describe "cancel new contact" do
    it "should hide [create contact] form" do
      params[:cancel] = "true"
      render

      rendered.should_not have_rjs("create_contact")
      rendered.should include('crm.flip_form("create_contact");')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fat_free_crm-0.11.4 spec/views/contacts/new.rjs_spec.rb