Sha256: 591c3c581ea9c86d52189feebc31b9890249177afe13fd50638baa37871d8590

Contents?: true

Size: 1.32 KB

Versions: 8

Compression:

Stored size: 1.32 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 File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/opportunities/index" do
  include OpportunitiesHelper

  before do
    login_and_assign
    view.lookup_context.prefixes << 'entities'
    assign :stage, Setting.unroll(:opportunity_stage)
    assign :per_page, Opportunity.per_page
    assign :sort_by,  Opportunity.sort_by
    assign :ransack_search, Opportunity.ransack
  end

  it "should render list of accounts if list of opportunities is not empty" do
    assign(:opportunities, [FactoryGirl.build_stubbed(:opportunity)].paginate)

    render
    expect(view).to render_template(partial: "_opportunity")
    expect(view).to render_template(partial: "shared/_paginate_with_per_page")
  end

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

    render
    expect(view).not_to render_template(partial: "_opportunities")
    expect(view).to render_template(partial: "shared/_empty")
    expect(view).to render_template(partial: "shared/_paginate_with_per_page")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fat_free_crm-0.15.2 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.16.4 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.15.1 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.16.3 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.16.2 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.16.1 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.16.0 spec/views/opportunities/index.haml_spec.rb
fat_free_crm-0.15.0 spec/views/opportunities/index.haml_spec.rb