Sha256: cb5cf54963bcdc010197f58e0aa200f1e7cc4579e908c8346dc553b37b1c7b2d
Contents?: true
Size: 1.93 KB
Versions: 2
Compression:
Stored size: 1.93 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 'spec_helper' describe "/contacts/create" do include ContactsHelper before do login end describe "create success" do before do assign(:contact, @contact = build_stubbed(:contact)) assign(:contacts, [@contact].paginate) end it "should hide [Create Contact] form and insert contact partial" do render expect(rendered).to include("$('#contacts').prepend('<li class=\\'highlight contact\\' id=\\'contact_#{@contact.id}\\'") expect(rendered).to include(%/$('#contact_#{@contact.id}').effect("highlight"/) end it "should refresh sidebar when called from contacts index" do controller.request.env["HTTP_REFERER"] = "http://localhost/contacts" render expect(rendered).to include("#sidebar") expect(rendered).to have_text("Recent Items") end it "should update pagination when called from contacts index" do controller.request.env["HTTP_REFERER"] = "http://localhost/contacts" render expect(rendered).to include("#paginate") end it "should update recently viewed items when called from related asset" do render expect(rendered).to include("#recently") end end describe "create failure" do it "create (failure): should re-render [create] template in :create_contact div" do assign(:contact, build(:contact, first_name: nil)) # make it invalid @account = build_stubbed(:account) assign(:users, [build_stubbed(:user)]) assign(:account, @account) assign(:accounts, [@account]) render expect(rendered).to include("$('#create_contact').html") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fat_free_crm-0.20.1 | spec/views/contacts/create.js.haml_spec.rb |
fat_free_crm-0.20.0 | spec/views/contacts/create.js.haml_spec.rb |