Sha256: 909fb918d14ea13af50c375387a1505f177c7e1f50301eb6f38ec45c36830891

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

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

  before do
    login
  end

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

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

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

3 entries across 3 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/campaigns/index.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/campaigns/index.js.haml_spec.rb
fat_free_crm-0.19.2 spec/views/campaigns/index.js.haml_spec.rb