<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/home/options.rjs" do
  before do
    login_and_assign
  end

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

    assign(:asset, "all")
    assign(:user, "all_users")
    assign(:duration, "two_days")
    assign(:all_users, [ Factory(: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(:user, "all_users")
    assign(:duration, "two_days")
    assign(:all_users, [ Factory(: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<commit_msg>Fixed specs for home/options<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/home/options.rjs" do
  before do
    login_and_assign
  end

  it "should render [options.html.haml] 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, [ Factory(: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, [ Factory(: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

{'fraction_non_alphanumeric': 0.15777338603425559, 'fraction_numerical': 0.0, 'mean_word_length': 3.882636655948553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5090437', 'n_tokens_mistral': 974, 'n_tokens_neox': 942, 'n_words': 210}