Sha256: c070245726d25cd6ec1df64b67f664b74c5c3f55f4e4818c12b3b8917ce0adec

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 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 "/campaigns/index" do
  include CampaignsHelper

  before do
    login_and_assign
  end

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

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

    expect(rendered).to include("$('#campaigns').html('<li class=\\'campaign highlight\\' id=\\'campaign_42\\'")
    expect(rendered).to include("#paginate")
  end

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

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

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