Sha256: ffbcbdac16421fa7a0ec411c424606a9f83adeb768d19069ffe4c3c1f4a8e2de

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 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 "/campaigns/new" do
  include CampaignsHelper

  before do
    login
    assign(:campaign, Campaign.new(user: current_user))
    assign(:users, [current_user])
  end

  it "should toggle empty message div if it exists" do
    render

    expect(rendered).to include("crm.flick('empty', 'toggle')")
  end

  describe "new campaign" do
    it "should render [new] template into :create_campaign div" do
      params[:cancel] = nil
      render

      expect(rendered).to include("$('#create_campaign').html")
    end

    it "should call JavaScript functions to load Calendar popup" do
      params[:cancel] = nil
      render

      expect(rendered).to include("crm.flip_form('create_campaign')")
    end
  end

  describe "cancel new campaign" do
    it "should hide [create campaign] form" do
      params[:cancel] = "true"
      render

      expect(rendered).not_to include("#create_campaignx")
      expect(rendered).to include("crm.flip_form('create_campaign')")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.19.2 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.19.0 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.18.2 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.17.3 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.18.1 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.18.0 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.17.2 spec/views/campaigns/new.js.haml_spec.rb
fat_free_crm-0.17.1 spec/views/campaigns/new.js.haml_spec.rb