Sha256: 9c91987db07dad38389d69a1dff9cb214f40eab13c5a3d19bcda8ef6c1d6bea7

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

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

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

  it "should render [opportunity] template with @opportunities collection if there are opportunities" do
    assign(:opportunities, [FactoryGirl.create(: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

4 entries across 4 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.14.1 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.14.0 spec/views/opportunities/index.js.haml_spec.rb
reduced_fat_crm-0.14.0 spec/views/opportunities/index.js.haml_spec.rb