Sha256: 34307ee5936215275f314d994e939b2298a8eefa09d0af7bf3335eeb23e33dee

Contents?: true

Size: 1.77 KB

Versions: 4

Compression:

Stored size: 1.77 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 "/home/options" do
  before do
    login_and_assign
  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, [ FactoryGirl.create(:user) ])

    render

    rendered.should have_rjs("options") do |rjs|
      with_tag("input[type=hidden]") # current_user

      user_menu = "onLoading:function(request){$('user').update('all users'); " +
                  "$('loading').show()}, parameters:'user=all_users'}); } } }"
      with_tag("script", /#{Regexp.escape(user_menu)}/)
    end
    rendered.should include('crm.flip_form("options")')
    rendered.should 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, [ FactoryGirl.create(:user) ])

    render

    view.should render_template(:partial => "_options")
  end

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

    rendered.should_not have_rjs("options")
    rendered.should include('crm.flip_form("options")')
    rendered.should include('crm.set_title("title", "Recent Activity")')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 spec/views/home/options.rjs_spec.rb
fat_free_crm-0.12.2 spec/views/home/options.rjs_spec.rb
fat_free_crm-0.12.1 spec/views/home/options.rjs_spec.rb
fat_free_crm-0.12.0 spec/views/home/options.rjs_spec.rb