Sha256: bd925ae7c67e09b59860641b0751224ae7d0325e47eee5e01d9b0bf24acbe4f6

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe '.projects' do
  it 'should fetch all projects' do
    stub = stub_get('/projects/', 'projects.json')

    client = MockGerry.new
    projects = client.projects

    expect(stub).to have_been_requested

    expect(projects['awesome']['description']).to eq('Awesome project')
    expect(projects['clean']['description']).to eq('Clean code!')
  end

  it 'should fetch a project' do
    stub = stub_get('/projects/awesome', 'projects.json')

    client = MockGerry.new
    projects = client.find_project('awesome')

    expect(stub).to have_been_requested

    expect(projects['awesome']['description']).to eq('Awesome project')
  end

  it 'should resolve the symbolic HEAD ref of a project' do
    project = 'awesome'
    stub = stub_get("/projects/#{project}/HEAD", 'project_head.json')

    client = MockGerry.new
    branch = client.get_head(project)

    expect(stub).to have_been_requested

    expect(branch).to eq('refs/heads/stable')
  end

  it 'should define the symbolic HEAD ref of a project' do
    project = 'awesome'
    branch = 'stable'
    input = {
      ref: 'refs/heads/' + branch
    }
    stub = stub_put("/projects/#{project}/HEAD", input.to_json, get_fixture('project_head.json'))

    client = MockGerry.new
    new_branch = client.set_head(project, branch)

    expect(stub).to have_been_requested

    expect(new_branch).to eq('refs/heads/' + branch)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gerry-0.1.5 spec/projects_spec.rb
gerry-0.1.4 spec/projects_spec.rb
gerry-0.1.3 spec/projects_spec.rb
gerry-0.1.2 spec/projects_spec.rb
gerry-0.1.1 spec/projects_spec.rb
gerry-0.1.0 spec/projects_spec.rb
gerry-0.0.4 spec/projects_spec.rb