Sha256: 16b2bc606e058b5b578133a69accf342c174922f90b998fb3154b607eaf992a1

Contents?: true

Size: 1.61 KB

Versions: 4

Compression:

Stored size: 1.61 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
    assign(:opportunity, FactoryGirl.build(:opportunity))
    @account = FactoryGirl.create(:account)
    assign(:account, @account)
    assign(:accounts, [@account])
    assign(:users, [current_user])
    assign(:stage, Setting.unroll(:opportunity_stage))
  end

  it "should render [create opportunity] form" do
    render
    expect(view).to render_template(partial: "opportunities/_top_section")
    expect(view).to render_template(partial: "entities/_permissions")

    expect(rendered).to have_tag("form[class=new_opportunity]")
  end

  it "should pick default assignee (Myself)" do
    render
    expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |options|
      expect(options.to_s).not_to include(%(selected="selected"))
    end
  end

  it "should render background info field if settings require so" do
    Setting.background_info = [:opportunity]

    render
    expect(rendered).to have_tag("textarea[id=opportunity_background_info]")
  end

  it "should not render background info field if settings do not require so" do
    Setting.background_info = []

    render
    expect(rendered).not_to have_tag("textarea[id=opportunity_background_info]")
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

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