<commit_before>require 'minitest/autorun'
require 'webmock/minitest'
require 'freckle'

describe 'Freckle::Client' do
  before do
    @token = '<PASSWORD>'

    @user_agent = 'account.letsfreckle.com'

    @base_url = 'https://api.letsfreckle.com/v2'

    @entry_id, @project_id, @id = 1234

    @auth_header = {headers: {'X-FreckleToken' => @token}}

    @json_request = {headers: {'X-FreckleToken' => @token, 'Content-Type' => 'application/json'}, body: /\A{.+}\z/}

    @json_response = {headers: {'Content-Type' => 'application/json;charset=utf-8'}, body: '{}'}

    @client = Freckle::Client.new(token: @token, user_agent: @user_agent)
  end

  after do
    assert_requested(@request) if defined?(@request)
  end

  describe 'get_timers method' do
    it 'fetches the timers resource and returns the decoded response object' do
      @request = stub_request(:get, "#@base_url/timers").with(@auth_header).to_return(@json_response.merge(body: '[]'))

      @client.get_timers.must_equal([])
    end

    it 'encodes optional filter parameters' do
      @request = stub_request(:get, "#@base_url/timers?billable=true")

      @client.get_timers(billable: true)
    end

    it 'encodes an array of ids into a single filter parameter' do
      @request = stub_request(:get, "#@base_url/timers?projects=4,5,6")

      @client.get_timers(projects: %w(4 5 6))<commit_msg>Fix spec assignment of @project_id and @id<commit_after>require 'minitest/autorun'
require 'webmock/minitest'
require 'freckle'

describe 'Freckle::Client' do
  before do
    @token = '<PASSWORD>'

    @user_agent = 'account.letsfreckle.com'

    @base_url = 'https://api.letsfreckle.com/v2'

    @entry_id = @project_id = @id = 1234

    @auth_header = {headers: {'X-FreckleToken' => @token}}

    @json_request = {headers: {'X-FreckleToken' => @token, 'Content-Type' => 'application/json'}, body: /\A{.+}\z/}

    @json_response = {headers: {'Content-Type' => 'application/json;charset=utf-8'}, body: '{}'}

    @client = Freckle::Client.new(token: @token, user_agent: @user_agent)
  end

  after do
    assert_requested(@request) if defined?(@request)
  end

  describe 'get_timers method' do
    it 'fetches the timers resource and returns the decoded response object' do
      @request = stub_request(:get, "#@base_url/timers").with(@auth_header).to_return(@json_response.merge(body: '[]'))

      @client.get_timers.must_equal([])
    end

    it 'encodes optional filter parameters' do
      @request = stub_request(:get, "#@base_url/timers?billable=true")

      @client.get_timers(billable: true)
    end

    it 'encodes an array of ids into a single filter parameter' do
      @request = stub_request(:get, "#@base_url/timers?projects=4,5,6")

      @client.get_timers(projects: %w(4 5 6))
{'fraction_non_alphanumeric': 0.15529071867100036, 'fraction_numerical': 0.00866738894907909, 'mean_word_length': 4.101289134438305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '4361374', 'n_tokens_mistral': 1003, 'n_tokens_neox': 952, 'n_words': 209}