Sha256: 72c34adacf6cfd1ec7deddb333328104faa3511c82e434f6c22d5309f35f6ef0

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 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.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

11 entries across 11 versions & 2 rubygems

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