Sha256: f744a7e4c22dddb2e3849743bebc4e09027cc033ce99b5480a4855bee72f05a9

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 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 "/leads/index" do
  include LeadsHelper

  before do
    login_and_assign
  end

  it "should render [lead] template with @leads collection if there are leads" do
    assign(:leads, [FactoryGirl.create(:lead, id: 42)].paginate(page: 1, per_page: 20))

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

    expect(rendered).to include("$('#leads').html('<li class=\\'highlight lead\\' id=\\'lead_42\\'")
    expect(rendered).to include("#paginate")
  end

  it "should render [empty] template if @leads collection if there are no leads" do
    assign(:leads, [].paginate(page: 1, per_page: 20))

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

    expect(rendered).to include("$('#leads').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/leads/index.js.haml_spec.rb
fat_free_crm-0.14.1 spec/views/leads/index.js.haml_spec.rb
fat_free_crm-0.14.0 spec/views/leads/index.js.haml_spec.rb
reduced_fat_crm-0.14.0 spec/views/leads/index.js.haml_spec.rb