Sha256: 5f129922611b5d4bd44cb4d4e71042b152bf690f23de882d5925e951e1cb04c5

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 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 'spec_helper'

describe "/tasks/index" do
  include TasksHelper

  before do
    login_and_assign
  end

  TASK_STATUSES.each do |status|
    before do
      user = FactoryGirl.create(:user)
      account = FactoryGirl.create(:account)
      @due  = FactoryGirl.create(:task, asset: account, bucket: "due_asap", assignee: user)
      @completed = FactoryGirl.create(:task, asset: account, bucket: "completed_today", assignee: user, completed_at: 1.hour.ago, completor: user)
    end

    it "should render list of #{status} tasks if list of tasks is not empty" do
      assign(:view, status)
      assign(:tasks,  due_asap: [@due], completed_today: [@completed])

      render

      expect(view).to render_template(partial: "_" << status, count: 1)
      expect(view).not_to render_template(partial: "_empty")
    end
  end

  TASK_STATUSES.each do |status|
    it "should render a message if there're no #{status} tasks" do
      assign(:view, status)
      assign(:tasks,  due_asap: [], due_today: [])

      render

      expect(view).to render_template(partial: "_empty")
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/views/tasks/index.haml_spec.rb
fat_free_crm-0.14.1 spec/views/tasks/index.haml_spec.rb
fat_free_crm-0.14.0 spec/views/tasks/index.haml_spec.rb
reduced_fat_crm-0.14.0 spec/views/tasks/index.haml_spec.rb