Sha256: 0fea758cf2f8bca042e8c7e0493606e1519cd6fed7b344389b2da2b23a1216c5

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 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 File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/home/options" do
  before do
    login
  end

  it "should render [options] template into :options div and show it" do
    params[:cancel] = nil

    assign(:asset, "all")
    assign(:user, "all_users")
    assign(:action, "all_actions")
    assign(:duration, "two_days")
    assign(:all_users, [build_stubbed(:user)])

    render

    expect(rendered).to include("$('#options').html")
    expect(rendered).to include("$(\\\'#asset\\\').html(\\\'campaign\\\')")
    expect(rendered).to include("crm.flip_form('options')")
    expect(rendered).to include("crm.set_title('title', 'Recent Activity Options')")
  end

  it "should load :options partial with JavaScript code for menus" do
    params[:cancel] = nil
    assign(:asset, "all")
    assign(:action, "all_actions")
    assign(:user, "all_users")
    assign(:duration, "two_days")
    assign(:all_users, [build_stubbed(:user)])

    render

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

  it "should hide options form on Cancel" do
    params[:cancel] = "true"
    render

    expect(rendered).not_to include("$('#options').html")
    expect(rendered).to include("crm.flip_form('options')")
    expect(rendered).to include("crm.set_title('title', 'Recent Activity')")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.19.2 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.19.0 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.18.2 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.18.1 spec/views/home/options.js.haml_spec.rb
fat_free_crm-0.18.0 spec/views/home/options.js.haml_spec.rb