Sha256: 2b66fa54471261c42d01840ebd6e7e2946c0e67418509f4a43327b4d79b54352

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 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 "/contacts/new" do
  include ContactsHelper

  before do
    login_and_assign
    @account = FactoryGirl.build_stubbed(: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

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

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

      expect(rendered).to include("$('#create_contact').html")
      expect(rendered).to include("crm.create_or_select_account(false)")
    end
  end

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

      expect(rendered).not_to include("$('#create_contact').html")
      expect(rendered).to include("crm.flip_form('create_contact');")
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

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