# 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 "/tasks/update" do include TasksHelper before do login_and_assign end describe "Changing due date" do before do assign(:task_before_update, FactoryGirl.build_stubbed(:task, bucket: "due_asap")) assign(:task, @task = FactoryGirl.build_stubbed(:task, bucket: "due_tomorrow")) assign(:view, "pending") assign(:task_total, stub_task_total("pending")) end it "from Tasks tab: should remove task from current bucket and hide empty bucket" do controller.request.env["HTTP_REFERER"] = "http://localhost/tasks" render expect(rendered).to include(%/$('#task_#{@task.id}').remove();/) expect(rendered).to include(%/$('#list_due_asap').fadeOut/) end it "from Tasks tab: should show updated task in a new bucket" do controller.request.env["HTTP_REFERER"] = "http://localhost/tasks" render expect(rendered).to include("$('#due_tomorrow').prepend('