Sha256: fd5804b3fd8ff9bd162d5545583035e37eef9a6f63a8fe50b17b1a1d46faf935

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')

describe "Repo" do

  let(:user_api) {
    Octokit::Client.new(
      login: ENV['LOGIN'],
      access_token: ENV['ACCESS_TOKEN']
    )
  }

  let(:file){
    f = File.expand_path(File.dirname(__FILE__) + '/../../fixtures/.travis.yml')
    Travis::Yaml.parse( File.open(f).read )
  }

  let(:github_user){
    Warden::GitHub::User.new
  }

  before(:each) do
    perkins_app
    allow_any_instance_of(Warden::GitHub::User).to receive(:api).and_return(user_api)
    @user = Warden::GitHub::User.new
    Perkins::Repo.sync_github_repos(@user)

    to_add = Perkins::Repo.synced_records.where(name: "michelson/lazy_high_charts").first
    r = Perkins::Repo.add_from_github(to_add.gb_id)
  end

  context "runner config" do
    before :each do
      @repo = Perkins::Repo.where(cached: false).last
      allow_any_instance_of(Perkins::Repo).to receive(:check_config_existence).and_return(file)
      @repo.load_git
      expect(@repo.git).to be_instance_of(Git::Base)
      @path = @repo.git.dir.path
    end

    after :each do
      Perkins::Repo.delete_all
    end

    it "should have a runner" do
      expect(@repo.runner).to be_instance_of(Perkins::Runner)
    end

    it "run run run should add a new report" do
      sha = @repo.git.log.map(&:sha).first
      @repo.runner.run(sha)
      expect(@repo.build_reports.size).to be == 1
      #binding.pry
      #expect(@repo.runner.status).to be == true
      #expect(@repo.runner.response).to_not be_blank
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
perkins-0.0.3 spec/lib/build/build_spec.rb
perkins-0.0.2 spec/lib/build/build_spec.rb
perkins-0.0.1 spec/lib/build/build_spec.rb