Sha256: 761a19fed8dfb381595b2c5a2e00beb4b113554824548b3adb511bb02a970420

Contents?: true

Size: 1.08 KB

Versions: 4

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 "/contacts/index" do
  include ContactsHelper

  before do
    login_and_assign
  end

  it "should render [contact] template with @contacts collection if there are contacts" do
    assign(:contacts, [FactoryGirl.create(:contact, id: 42)].paginate)

    render template: 'contacts/index', formats: [:js]

    expect(rendered).to include("$('#contacts').html('<li class=\\'contact highlight\\' id=\\'contact_42\\'")
    expect(rendered).to include("#paginate")
  end

  it "should render [empty] template if @contacts collection if there are no contacts" do
    assign(:contacts, [].paginate)

    render template: 'contacts/index', formats: [:js]

    expect(rendered).to include("$('#contacts').html('<div id=\\'empty\\'>")
    expect(rendered).to include("#paginate")
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/views/contacts/index.js.html_spec.rb
fat_free_crm-0.14.1 spec/views/contacts/index.js.html_spec.rb
fat_free_crm-0.14.0 spec/views/contacts/index.js.html_spec.rb
reduced_fat_crm-0.14.0 spec/views/contacts/index.js.html_spec.rb