Sha256: efcdd727ed51c0268f912f8a3e898c04610e8e2c9d1497c7151fe34c903c7150

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 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 "/opportunities/index" do
  include OpportunitiesHelper

  before do
    login
    assign(:stage, Setting.unroll(:opportunity_stage))
  end

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

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

    expect(rendered).to include("$('#opportunities').html")
    expect(rendered).to include("#paginate")
  end

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

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

    expect(rendered).to include("$('#opportunities').html('<div id=\\'empty\\'>")
    expect(rendered).to include("#paginate")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.19.2 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.19.0 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.18.2 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.18.1 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.18.0 spec/views/opportunities/index.js.haml_spec.rb