Sha256: cb3f9bae428bd2ee9803850a59ce2f6b4af0663e337f20cb5ab22a105697252c

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 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/new" do
  include OpportunitiesHelper

  before do
    login_and_assign
    @account = FactoryGirl.create(:account)
    assign(:opportunity, Opportunity.new(:user => current_user))
    assign(:users, [ current_user ])
    assign(:account, @account)
    assign(:accounts, [ @account ])
    assign(:stage, Setting.unroll(:opportunity_stage))
  end

  it "should toggle empty message div if it exists" do
    render

    rendered.should include("crm.flick('empty', 'toggle')")
  end

  describe "new opportunity" do
    it "should render [new] template into :create_opportunity div" do
      params[:cancel] = nil
      render

      rendered.should include("#create_opportunity")
    end

    it "should call JavaScript functions to load Calendar popup" do
      params[:cancel] = nil
      render

      rendered.should include("crm.flip_form('create_opportunity')")
    end
  end

  describe "cancel new opportunity" do
    it "should hide [create campaign] form" do
      params[:cancel] = "true"
      render

      rendered.should_not include("#create_opportunity")
      rendered.should include("crm.flip_form('create_opportunity')")
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.5 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.4 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.3 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.2 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.1 spec/views/opportunities/new.js.haml_spec.rb
fat_free_crm-0.13.0 spec/views/opportunities/new.js.haml_spec.rb