Sha256: 0d5d34f0768a8a3c45b694d5b1b19c3845c29bc30eaa433ec222860ba2cbee0c

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

# 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 "/contacts/_new" do
  include ContactsHelper

  before do
    login
    @account = build_stubbed(:account)
    assign(:contact, Contact.new)
    assign(:users, [current_user])
    assign(:account, @account)
    assign(:accounts, [@account])
  end

  it "should render [create contact] form" do
    render
    expect(view).to render_template(partial: "contacts/_top_section")
    expect(view).to render_template(partial: "contacts/_extra")
    expect(view).to render_template(partial: "contacts/_web")
    expect(view).to render_template(partial: "entities/_permissions")

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

  it "should pick default assignee (Myself)" do
    render
    expect(rendered).to have_tag("select[id=contact_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 = [:contact]

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fat_free_crm-0.19.2 spec/views/contacts/_new.haml_spec.rb
fat_free_crm-0.19.0 spec/views/contacts/_new.haml_spec.rb
fat_free_crm-0.18.2 spec/views/contacts/_new.haml_spec.rb
fat_free_crm-0.18.1 spec/views/contacts/_new.haml_spec.rb
fat_free_crm-0.18.0 spec/views/contacts/_new.haml_spec.rb