<commit_before>require 'spec_helper'

describe OAuth1::Helper do
  let(:url) { "http://example.com" }
  let(:params) { {my_special_param: "params"} }
  let(:consumer_key) { "some_key" }
  let(:consumer_secret) { "some_secret" }

  let(:helper) { OAuth1::Helper.new(:get, url, params, {consumer_key: consumer_key, consumer_secret: consumer_secret}) }

  describe "#url_params" do
    let(:url_params) { helper.url_params }
    it "prepends oauth_ to option keys" do
      url_params.keys.should include(:oauth_consumer_key)
    end

    it "has some default options" do
      url_params.keys.should include(:oauth_version)
    end

    it "doesn't include the consumer_secret" do
      url_params.keys.should_not include("oauth_consumer_secret")
    end

    it "has oauth_token as an empty string" do
      url_params[:oauth_token].should eq("")
    end
  end

  describe "#url_params" do
    let(:url_params) { helper.url_params }
    it "returns an array with the options and the params" do
      url_params.should have(7).params
    end

    it "has the user-specified params" do
      url_params.keys.should include(:my_special_param)
    end
  end

  describe "#signature_base" do
    let(:signature_base) { helper.signature_base }
    it "returns an escaped string with method" do
      signature_base.should match(/GET/)
    end

    it "returns an escaped string with url" do
      signature_base.should match(/example.com/)
    end

    it "returns an escaped string with the params" do
      signature_base.should match(/oauth_consumer_key/)
      signature_base.should match(/my_special_param/)
    end
  end

  describe "#full_url" do
    let(:full_url) { helper.full_url }
    it "returns the url with the params for auth" do
      full_url.should match(/oauth_consumer_key=#{consumer_key}/)
      full_url.should match(/oauth_signature_method=HMAC-SHA1/)
      full_url.should match(/my_special_param/)
    end
  end
end<commit_msg>Making sure signature is being appended to the params.<commit_after>require 'spec_helper'

describe OAuth1::Helper do
  let(:url) { "http://example.com" }
  let(:params) { {my_special_param: "params"} }
  let(:consumer_key) { "some_key" }
  let(:consumer_secret) { "some_secret" }

  let(:helper) { OAuth1::Helper.new(:get, url, params, {consumer_key: consumer_key, consumer_secret: consumer_secret}) }

  describe "#url_params" do
    let(:url_params) { helper.url_params }
    it "prepends oauth_ to option keys" do
      url_params.keys.should include(:oauth_consumer_key)
    end

    it "has some default options" do
      url_params.keys.should include(:oauth_version)
    end

    it "doesn't include the consumer_secret" do
      url_params.keys.should_not include("oauth_consumer_secret")
    end

    it "has oauth_token as an empty string" do
      url_params[:oauth_token].should eq("")
    end
  end

  describe "#url_params" do
    let(:url_params) { helper.url_params }
    it "returns an array with the options and the params" do
      url_params.should have(7).params
    end

    it "has the user-specified params" do
      url_params.keys.should include(:my_special_param)
    end
  end

  describe "#signature_base" do
    let(:signature_base) { helper.signature_base }
    it "returns an escaped string with method" do
      signature_base.should match(/GET/)
    end

    it "returns an escaped string with url" do
      signature_base.should match(/example.com/)
    end

    it "returns an escaped string with the params" do
      signature_base.should match(/oauth_consumer_key/)
      signature_base.should match(/my_special_param/)
    end
  end

  describe "#full_url" do
    let(:full_url) { helper.full_url }
    it "returns the url with the params for auth" do
      full_url.should match(/oauth_consumer_key=#{consumer_key}/)
      full_url.should match(/oauth_signature_method=HMAC-SHA1/)
      full_url.should match(/oauth_signature=/)
      full_url.should match(/my_special_param/)
    end
  end
end
{'fraction_non_alphanumeric': 0.09922130118060789, 'fraction_numerical': 0.002009545340366742, 'mean_word_length': 3.479190101237345, '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': '3920073', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1237, 'n_words': 333}