Sha256: 36509bca67c49685dc026647ca1b2e7b522c224126d9a4e6c957580f2dcd0ccb

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe 'description' do

  before(:each) do
    GitWakaTime.config.git = Git.open(@wdir)
    GitWakaTime::Mapper.new(start_at: Date.new(2015, 1, 24))
    @commits = GitWakaTime::Commit
    @files   = GitWakaTime::CommitedFile
    @query = GitWakaTime::Query.new(@commits, @files, File.basename(@wdir))
  end

  before do
    stub_request(:get, 'https://wakatime.com/api/v1/heartbeats')
    .with(query: hash_including(:start, :end))
    .to_return(body: File.read('./spec/fixtures/heartbeats.json'), status: 200)
  end

  it 'can be run on dummy' do
    heartbeats = @query.get

    expect(heartbeats).to be_a Array
    expect(heartbeats.size).to eq 9 # 10ths is lonely
    expect(heartbeats.last).to be_a GitWakaTime::Heartbeat
    expect(heartbeats.last.branch).to eq 'master'
  end
  it 'produces valid search for api' do

    heartbeats = @query.build_requests

    expect(heartbeats).to be_a Array
    expect(heartbeats.first[:start].to_date).to eq Date.new(2015, 01, 29)
    expect(heartbeats.first[:end].to_date).to eq Date.new(2015, 03, 05)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitwakatime-0.2.2 spec/query_spec.rb
gitwakatime-0.2.1 spec/query_spec.rb
gitwakatime-0.2.0 spec/query_spec.rb