Sha256: b55fb77e5272ca8f0f8538302d438284162dfc97d03287fa1df9014bb2847b38

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 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 File.expand_path(File.dirname(__FILE__) + '/../../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 have_rjs("create_opportunity") do |rjs|
        with_tag("form[class=new_opportunity]")
      end
    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 have_rjs("create_opportunity")
      rendered.should include('crm.flip_form("create_opportunity")')
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 spec/views/opportunities/new.rjs_spec.rb
fat_free_crm-0.12.2 spec/views/opportunities/new.rjs_spec.rb
fat_free_crm-0.12.1 spec/views/opportunities/new.rjs_spec.rb
fat_free_crm-0.12.0 spec/views/opportunities/new.rjs_spec.rb