<commit_before>require 'spec_helper'

describe BackdropAPI do
  
  describe "get_licences" do
    
    it "should retrieve a list of licences" do
      
      response = { "data" => "some-licenses" }

      FakeWeb.register_uri(:get,
                           "http://backdrop/performance/licensing/api?group_by=licenceUrlSlug&collect=licenceName&period=week",
                           :body => response.to_json)
            
      client = BackdropAPI.new("http://backdrop/")
      licences = client.get_licences

      licences.should == response
    end
    
  end

  describe "get_licence" do
    
    it "should retrieve data for a specific licence" do

      response = { "data" => "data-for-a-specific-licence" }

      FakeWeb.register_uri(:get,
                           "http://backdrop/performance/licensing/api?filter_by=licenceUrlSlug:application-to-licence-a-street-collection&group_by=licenceUrlSlug&collect=licenceName&period=all",<commit_msg>Clear fakeweb registry before each test<commit_after>require 'spec_helper'

describe BackdropAPI do

  before :each do
    FakeWeb.clean_registry
  end
  
  describe "get_licences" do
    
    it "should retrieve a list of licences" do
      
      response = { "data" => "some-licenses" }

      FakeWeb.register_uri(:get,
                           "http://backdrop/performance/licensing/api?group_by=licenceUrlSlug&collect=licenceName&period=week",
                           :body => response.to_json)
            
      client = BackdropAPI.new("http://backdrop/")
      licences = client.get_licences

      licences.should == response
    end
    
  end

  describe "get_licence" do
    
    it "should retrieve data for a specific licence" do

      response = { "data" => "data-for-a-specific-licence" }

      FakeWeb.register_uri(:get,
                           "http://backdrop/performance/licensing/api?filter_by=licenceUrlSlug:application-to-licence-a-street-collection&group_by=licenceUrlSlug&collect=licenceName&period=all",
{'fraction_non_alphanumeric': 0.1027944111776447, 'fraction_numerical': 0.0, 'mean_word_length': 2.5361552028218695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4601710', 'n_tokens_mistral': 622, 'n_tokens_neox': 595, 'n_words': 105}