<commit_before>require 'parameters/parameters'

require 'spec_helper'

require 'classes/test_parameters'
require 'classes/custom_parameters'
require 'classes/inherited_parameters'
require 'classes/other_parameters'

describe Parameters do
  describe "in a Class" do
    it "should provide parameters" do
      TestParameters.params.should_not be_empty
    end

    it "can have default values for parameters" do
      TestParameters.param_value(:var_with_default).should == 'thing'
    end

    it "should provide class methods for paremters" do
      TestParameters.var = 1
      TestParameters.var.should == 1
    end

    it "should inherite the super-classes parameters" do
      InheritedParameters.has_param?(:var).should == true
      InheritedParameters.has_param?(:child_var).should == true
    end

    it "should provide direct access to the parameter objects" do
      param = TestParameters.get_param(:var)

      param.should_not be_nil
      param.name.should == :var
    end

    it "raise a ParamNotFound exception when directly accessing non-existent parameter objects" do
      lambda { TestParameters.get_param(:unknown) }.should raise_error(Parameters::ParamNotFound)
    end

    it "should provide descriptions for parameters" do
      TestParameters.describe_param(:var).should_not be_empty
    end

    it "should be able to initialize parameters" do
      obj = TestParameters.new

      obj.params.should_not be_empty
    end

    it "should set initialize parameters with initial nil values" do
      obj = CustomParameters.new

      obj.var_with_default.should == 10
    end

    it "should not override previous parameter values" do
      obj = CustomParameters.new(:test,5)

      obj.var.should == :test
      obj.var_with_default.should == 5
    end

    it "should be able to create an object with initial parameter values" do
      obj = TestParameters.new(:var => 2, :var_with_default => 'stuff')

      obj.var.should == 2
      obj.var_with_default.should == 'stuff'
    end
  end
<commit_msg>Added a spec to ensure initialize_params will not override false values.<commit_after>require 'parameters/parameters'

require 'spec_helper'

require 'classes/test_parameters'
require 'classes/custom_parameters'
require 'classes/inherited_parameters'
require 'classes/other_parameters'

describe Parameters do
  describe "in a Class" do
    it "should provide parameters" do
      TestParameters.params.should_not be_empty
    end

    it "can have default values for parameters" do
      TestParameters.param_value(:var_with_default).should == 'thing'
    end

    it "should provide class methods for paremters" do
      TestParameters.var = 1
      TestParameters.var.should == 1
    end

    it "should inherite the super-classes parameters" do
      InheritedParameters.has_param?(:var).should == true
      InheritedParameters.has_param?(:child_var).should == true
    end

    it "should provide direct access to the parameter objects" do
      param = TestParameters.get_param(:var)

      param.should_not be_nil
      param.name.should == :var
    end

    it "raise a ParamNotFound exception when directly accessing non-existent parameter objects" do
      lambda { TestParameters.get_param(:unknown) }.should raise_error(Parameters::ParamNotFound)
    end

    it "should provide descriptions for parameters" do
      TestParameters.describe_param(:var).should_not be_empty
    end

    it "should be able to initialize parameters" do
      obj = TestParameters.new

      obj.params.should_not be_empty
    end

    it "should set initialize parameters with initial nil values" do
      obj = CustomParameters.new

      obj.var_with_default.should == 10
    end

    it "should not override previous parameter values" do
      obj = CustomParameters.new(:test,5)

      obj.var.should == :test
      obj.var_with_default.should == 5
    end

    it "should not override previous 'false' values of parameters" do
      obj = CustomParameters.new(false,false)

      obj.var.should == false
      obj.var_with_default.should == false
    end

    it "should be able to create an object with initial parameter values" do
      obj = TestParameters.new(:var => 2, :var_with_default => 'stuff')

      obj.var.should == 2
      obj.var_with_default.should == 'stuff'
    end
  end

{'fraction_non_alphanumeric': 0.07542804257288292, 'fraction_numerical': 0.0037019898195279964, 'mean_word_length': 3.284440039643211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2451625', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1158, 'n_words': 377}