<commit_before># encoding: utf-8

require 'spec_helper'

describe DetectLanguage do

  context "configuration" do
    it "should have default configuration values" do
      subject.configuration.api_key.should      be_nil
      subject.configuration.api_version.should  == '0.2'
      subject.configuration.host.should         == 'ws.detectlanguage.com'
      subject.configuration.user_agent.should   == 'Detect Language API ruby gem'
    end

    it "should allow configuring" do
      subject.configure do |config|
        config.user_agent = "Detect Language testing"
      end

      subject.configuration.user_agent.should == "Detect Language testing"
    end
  end

  context "detection" do
    before do
      # testing key
      subject.configuration.api_key = "24c3185fef623b537a4df60df0a8d4d9"
    end

    it "should detect languages" do
      result = subject.detect("Hello world")
      result[0]['language'].should == "en"

      result = subject.detect("Jau saulelė vėl atkopdama budino svietą")
      result[0]['language'].should == "lt"
    end
<commit_msg>Update test API key<commit_after># encoding: utf-8

require 'spec_helper'

describe DetectLanguage do

  context "configuration" do
    it "should have default configuration values" do
      subject.configuration.api_key.should      be_nil
      subject.configuration.api_version.should  == '0.2'
      subject.configuration.host.should         == 'ws.detectlanguage.com'
      subject.configuration.user_agent.should   == 'Detect Language API ruby gem'
    end

    it "should allow configuring" do
      subject.configure do |config|
        config.user_agent = "Detect Language testing"
      end

      subject.configuration.user_agent.should == "Detect Language testing"
    end
  end

  context "detection" do
    before do
      # testing key
      subject.configuration.api_key = "<KEY>"
    end

    it "should detect languages" do
      result = subject.detect("Hello world")
      result[0]['language'].should == "en"

      result = subject.detect("Jau saulelė vėl atkopdama budino svietą")
      result[0]['language'].should == "lt"
    end

{'fraction_non_alphanumeric': 0.09394081728511038, 'fraction_numerical': 0.013621418506341005, 'mean_word_length': 2.9738805970149254, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4796139', 'n_tokens_mistral': 634, 'n_tokens_neox': 602, 'n_words': 163}