# 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 "/leads/update" do before do login_and_assign assign(:lead, @lead = FactoryGirl.create(:lead, :user => current_user, :assignee => FactoryGirl.create(:user))) assign(:users, [ current_user ]) assign(:campaigns, [ FactoryGirl.create(:campaign) ]) assign(:lead_status_total, Hash.new(1)) end describe "no errors:" do describe "on landing page -" do before do controller.request.env["HTTP_REFERER"] = "http://localhost/leads/123" end it "should flip [edit_lead] form" do render rendered.should_not include("lead_#{@lead.id}x") rendered.should include("crm.flip_form('edit_lead'") end it "should update sidebar" do render rendered.should include("#sidebar") rendered.should have_text("Lead Summary") rendered.should include("jQuery('#summary').effect('shake'") end end describe "on index page -" do before do controller.request.env["HTTP_REFERER"] = "http://localhost/leads" end it "should replace [Edit Lead] with lead partial and highlight it" do render rendered.should include("jQuery('#lead_#{@lead.id}').replaceWith('