Sha256: b9855a2d916a4db0cb779dd8bc4b3f8c758447d6b4d3cc80d425782aee3cb8b1

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 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
    view.lookup_context.prefixes << 'entities'
    assign :per_page, Contact.per_page
    assign :sort_by,  Contact.sort_by
    assign :ransack_search, Contact.search
    login_and_assign
  end

  it "should render a list of contacts if it's not empty" do
    assign(:contacts, [ FactoryGirl.create(:contact) ].paginate)

    render
    view.should render_template(:partial => "_contact")
    view.should render_template(:partial => "shared/_paginate_with_per_page")
  end

  it "should render a message if there're no contacts" do
    assign(:contacts, [].paginate)

    render
    view.should_not render_template(:partial => "_contact")
    view.should render_template(:partial => "shared/_empty")
    view.should render_template(:partial => "shared/_paginate_with_per_page")
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.5 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.4 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.3 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.2 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.1 spec/views/contacts/index.haml_spec.rb
fat_free_crm-0.13.0 spec/views/contacts/index.haml_spec.rb