<commit_before>require "spec_helper"

describe LastFM::APIClass do
  it "should define unrestricted methods" do
    LastFM::APIClass.unrestricted_methods(:foo, :bar, :baz)
    LastFM::APIClass.unrestricted_methods.should be_an(Array)
  end

  it "should not allow to call an undefined method" do
    lambda { LastFM::APIClass.i_wasnt_defined }.should raise_error(NoMethodError)
  end

  it "should not allow to call a method with invalid params" do
    lambda { LastFM::APIClass.foo("not a hash") }.should raise_error(ArgumentError, "Params should be a hash")
  end

  it "should respond to unrestricted methods" do
    LastFM.should_receive(:send_api_request).with("apiclass.foo", {:bar => :baz}).and_return({})
    LastFM::APIClass.foo(:bar => :baz).should be_a(Hash)
  end

  it "should define restricted methods" do
    LastFM::APIClass.restricted_methods(:foo1, :bar1, :baz1)
    LastFM::APIClass.should respond_to(:foo1)
    LastFM::APIClass.should respond_to(:bar1)
    LastFM::APIClass.should respond_to(:baz1)
  end

  it "should respond to restricted methods" do
    LastFM.should_receive(:send_api_request).with("apiclass.foo1", {:bar => :baz, :api_sig => true}).and_return({})
    LastFM::APIClass.foo1(:bar => :baz).should be_a(Hash)
  end
end
<commit_msg>Add request_method param to send_api_request<commit_after>require "spec_helper"

describe LastFM::APIClass do
  it "should define unrestricted methods" do
    LastFM::APIClass.unrestricted_methods(:foo, :bar, :baz)
    LastFM::APIClass.unrestricted_methods.should be_an(Array)
  end

  it "should not allow to call an undefined method" do
    lambda { LastFM::APIClass.i_wasnt_defined }.should raise_error(NoMethodError)
  end

  it "should not allow to call a method with invalid params" do
    lambda { LastFM::APIClass.foo("not a hash") }.should raise_error(ArgumentError, "Params should be a hash")
  end

  it "should respond to unrestricted methods" do
    LastFM.should_receive(:send_api_request).with("apiclass.foo", {:bar => :baz}, :get).and_return({})
    LastFM::APIClass.foo(:bar => :baz).should be_a(Hash)
  end

  it "should define restricted methods" do
    LastFM::APIClass.restricted_methods(:foo1, :bar1, :baz1)
    LastFM::APIClass.should respond_to(:foo1)
    LastFM::APIClass.should respond_to(:bar1)
    LastFM::APIClass.should respond_to(:baz1)
  end

  it "should respond to restricted methods" do
    LastFM.should_receive(:send_api_request).with("apiclass.foo1", {:bar => :baz, :api_sig => true}, :get).and_return({})
    LastFM::APIClass.foo1(:bar => :baz).should be_a(Hash)
  end
end

{'fraction_non_alphanumeric': 0.1239829523440527, 'fraction_numerical': 0.006199147617202635, 'mean_word_length': 5.018648018648019, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6474598', 'n_tokens_mistral': 889, 'n_tokens_neox': 856, 'n_words': 212}