Sha256: 92b632e10e5873c94978a7ff4282c9e50c097016062cf178c2755bd0ff136b0b

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]

    rendered.should include("$('#opportunities').html")
    rendered.should 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]

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.13.5 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.13.4 spec/views/opportunities/index.js.haml_spec.rb
fat_free_crm-0.13.3 spec/views/opportunities/index.js.haml_spec.rb