Sha256: 751c8f539d8d87c918601d98d3e088dba6e8838edbf50f0dae65634d4f555b99

Contents?: true

Size: 1.99 KB

Versions: 11

Compression:

Stored size: 1.99 KB

Contents

require 'helper'

describe Octokit::Client::Milestones do

  before do
    Octokit.reset!
    @client = oauth_client
  end

  describe ".list_milestones", :vcr do
    it "lists milestones belonging to repository" do
      milestones = @client.list_milestones("api-playground/api-sandbox")
      expect(milestones).to be_kind_of Array
      assert_requested :get, github_url("/repos/api-playground/api-sandbox/milestones")
    end
  end # .list_milestones

  context "methods that need a milestone" do

    before(:each) do
      name = "Test Milestone #{Time.now.to_i}"
      @milestone = @client.create_milestone("api-playground/api-sandbox", name)
    end

    after(:each) do
      @client.delete_milestone("api-playground/api-sandbox", @milestone.number)
    end

    describe ".milestone", :vcr do
      it "gets a single milestone belonging to repository" do
        milestone = @client.milestone("api-playground/api-sandbox", @milestone.number)
        assert_requested :get, github_url("/repos/api-playground/api-sandbox/milestones/#{@milestone.number}")
      end
    end # .milestone

    describe ".create_milestone", :vcr do
      it "creates a milestone" do
        expect(@milestone.title).to_not be_nil
        assert_requested :post, github_url("/repos/api-playground/api-sandbox/milestones")
      end
    end # .create_milestone

    describe ".update_milestone", :vcr do
      it "updates a milestone" do
        @client.update_milestone("api-playground/api-sandbox", @milestone.number, {:description => "Add support for API v3"})
        assert_requested :patch, github_url("/repos/api-playground/api-sandbox/milestones/#{@milestone.number}")
      end
    end # .update_milestone

    describe ".delete_milestone", :vcr do
      it "deletes a milestone from a repository" do
        @client.delete_milestone("api-playground/api-sandbox", @milestone.number)
        assert_requested :delete, github_url("/repos/api-playground/api-sandbox/milestones/#{@milestone.number}")
      end
    end # .delete_milestone

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
octokit-2.3.0 spec/octokit/client/milestones_spec.rb
octokit-2.2.0 spec/octokit/client/milestones_spec.rb
octokit-2.1.2 spec/octokit/client/milestones_spec.rb
octokit-2.1.1 spec/octokit/client/milestones_spec.rb
octokit-2.1.0 spec/octokit/client/milestones_spec.rb
octokit-2.0.0 spec/octokit/client/milestones_spec.rb
octokit-2.0.0.rc4 spec/octokit/client/milestones_spec.rb
octokit-2.0.0.rc3 spec/octokit/client/milestones_spec.rb
octokit-2.0.0.rc2 spec/octokit/client/milestones_spec.rb
octokit-2.0.0.rc1 spec/octokit/client/milestones_spec.rb
octokit-2.0.0.pre spec/octokit/client/milestones_spec.rb