<commit_before># encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Param do
  before do
    @param = default_param
  end

  it "has a name" do
    @param.name.must_equal 'id'
  end

  it "has a description" do
    @param.description.must_equal 'Identifier'
  end

  it "returns an array of HTTP methods it's required for" do
    @param.required.must_equal %w(PUT PATCH DELETE)
  end

  it "returns true if the param is required for the given HTTP method" do
    @param.required?('PUT').must_equal true
  end

  it "returns false if the param is not required for the given HTTP method" do
    @param.required?('POST').must_equal false
  end

  it "converts itself as a hash" do
    constraints = { name: 'id', description: 'Identifier', type: 'String', constraints: 'Required for: PUT, PATCH, DELETE. Must be a valid BSON Object ID.' }
    @param.to_hash.must_equal constraints
  end
end<commit_msg>specs an untested branch of logic<commit_after># encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Param do
  before do
    @param = default_param
  end

  it "has a name" do
    @param.name.must_equal 'id'
  end

  it "has a description" do
    @param.description.must_equal 'Identifier'
  end

  it "returns an array of HTTP methods it's required for" do
    @param.required.must_equal %w(PUT PATCH DELETE)
  end

 it "returns an array if only a single HTTP method is required" do
    Hyperdrive::Filter.new(:param, '', required: 'GET').required.must_equal ['GET']
  end

  it "returns true if the param is required for the given HTTP method" do
    @param.required?('PUT').must_equal true
  end

  it "returns false if the param is not required for the given HTTP method" do
    @param.required?('POST').must_equal false
  end

  it "converts itself to a hash" do
    constraints = { name: 'id', description: 'Identifier', type: 'String', constraints: 'Required for: PUT, PATCH, DELETE. Must be a valid BSON Object ID.' }
    @param.to_hash.must_equal constraints
  end
end
{'fraction_non_alphanumeric': 0.093687374749499, 'fraction_numerical': 0.001002004008016032, 'mean_word_length': 3.644186046511628, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5423742', 'n_tokens_mistral': 630, 'n_tokens_neox': 611, 'n_words': 244}