Sha256: ba2f96b33b527425d7b0d3124ae95dfe7101740f1b194115f4ac959b0666405b

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

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

  before do
    login
  end

  TASK_STATUSES.each do |status|
    describe "destroy from Tasks tab (#{status} view)" do
      before do
        @task = build_stubbed(: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
        expect(rendered).to include("slideUp")
        expect(rendered).to include("$('#list_due_asap').fadeOut")
      end

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

        render
        expect(rendered).to include("$('#sidebar').html")
        expect(rendered).to have_text("Recent Items")
        expect(rendered).to have_text("Completed")
      end
    end
  end

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

      render
      expect(rendered).to include("slideUp")
      expect(rendered).not_to include("fadeOut") # bucket is not empty
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/tasks/destroy.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/tasks/destroy.js.haml_spec.rb