Sha256: c5bd02daf44d5feb49703b2faf9d0a5ca93eac91db55c88320c2063596deb2c9

Contents?: true

Size: 1.87 KB

Versions: 4

Compression:

Stored size: 1.87 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 "/tasks/destroy" do
  include TasksHelper

  before do
    login_and_assign
  end

  TASK_STATUSES.each do |status|
    describe "destroy from Tasks tab (#{status} view)" do
      before do
        @task = FactoryGirl.create(:task)
        assign(:task, @task)
        assign(:view, status)
        assign(:empty_bucket, :due_asap)
        assign(:task_total, stub_task_total(status))
      end

      it "should blind up out destroyed task partial" do
        controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"

        render
        rendered.should include(%Q/$("task_#{@task.id}").visualEffect("blind_up"/)
        rendered.should include(%Q/$("list_due_asap").visualEffect("fade"/)
      end

      it "should update tasks sidebar" do
        controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"

        render
        rendered.should have_rjs("sidebar") do |rjs|
          with_tag("div[id=filters]")
          with_tag("div[id=recently]")
        end
        rendered.should include(%Q/$("filters").visualEffect("shake"/)
      end
    end
  end

  describe "destroy from related asset" do
    it "should blind up out destroyed task partial" do
      @task = FactoryGirl.create(:task)
      assign(:task, @task)
      controller.request.env["HTTP_REFERER"] = "http://localhost/leads/123"

      render
      rendered.should include(%Q/$("task_#{@task.id}").visualEffect("blind_up"/)
      rendered.should_not include(%Q/$("list_due_asap").visualEffect("fade"/) # bucket is not empty
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 spec/views/tasks/destroy.rjs_spec.rb
fat_free_crm-0.12.2 spec/views/tasks/destroy.rjs_spec.rb
fat_free_crm-0.12.1 spec/views/tasks/destroy.rjs_spec.rb
fat_free_crm-0.12.0 spec/views/tasks/destroy.rjs_spec.rb