Sha256: b4052a24cbc23b43e1a6e4185cc7b6f5d39370e91a91a13f4e91001b3e58b5db

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

# 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
  end

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

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

    expect(rendered).to include("$('#contacts').html('<li class=\\'highlight contact\\' 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

3 entries across 3 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/contacts/index.js.html_spec.rb
fat_free_crm-0.20.0 spec/views/contacts/index.js.html_spec.rb
fat_free_crm-0.19.2 spec/views/contacts/index.js.html_spec.rb