Sha256: de231657c8166a778a49617870b2fb66400e1fb7e46a42fd4ccba04e678ddeeb

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 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 "/leads/_edit" do
  include LeadsHelper

  before do
    login_and_assign
    assign(:lead, @lead = FactoryGirl.create(:lead))
    assign(:users, [current_user])
    assign(:campaign, @campaign = FactoryGirl.create(:campaign))
    assign(:campaigns, [@campaign])
  end

  it "should render [edit lead] form" do
    render
    expect(view).to render_template(partial: "leads/_top_section")
    expect(view).to render_template(partial: "leads/_status")
    expect(view).to render_template(partial: "leads/_contact")
    expect(view).to render_template(partial: "leads/_web")
    expect(view).to render_template(partial: "entities/_permissions")

    expect(rendered).to have_tag("form[class=edit_lead]") do
      with_tag "input[type=hidden][id=lead_user_id][value='#{@lead.user_id}']"
    end
  end

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

    render
    expect(rendered).to have_tag("textarea[id=lead_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=lead_background_info]")
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/views/leads/_edit.haml_spec.rb
fat_free_crm-0.14.1 spec/views/leads/_edit.haml_spec.rb
fat_free_crm-0.14.0 spec/views/leads/_edit.haml_spec.rb
reduced_fat_crm-0.14.0 spec/views/leads/_edit.haml_spec.rb