Sha256: 59021de03432b7ec39688c63bbcbd04aff1c37d5cfa7dfa0313e787b977989c3

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

require 'spec_helper'

describe Gitlab::Client do
  describe ".labels" do
    before do
      stub_get("/projects/3/labels", "labels")
      @labels = Gitlab.labels(3)
    end

    it "should get the correct resource" do
      expect(a_get("/projects/3/labels")).to have_been_made
    end

    it "should return an array of project's labels" do
      expect(@labels).to be_an Array
      expect(@labels.first.name).to eq("Backlog")
    end
  end

  describe ".delete" do
    before do
      stub_delete("/projects/3/labels", "label")
      @label = Gitlab.delete_label(3, "Backlog")
    end

    it "should get the correct resource" do
      expect(a_delete("/projects/3/labels").
             with(:body => {:name => 'Backlog'})).to have_been_made
    end

    it "should return information about a deleted snippet" do
      expect(@label.name).to eq("Backlog")
    end
  end

  describe ".edit_label" do
    before do
      stub_put("/projects/3/labels", "label")
      @label = Gitlab.edit_label(3, "TODO", :new_name => 'Backlog')
    end

    it "should get the correct resource" do
      expect(a_put("/projects/3/labels").
             with(:body => {:name => 'TODO', :new_name => "Backlog"})).to have_been_made
    end

    it "should return information about an edited label" do
      expect(@label.name).to eq("Backlog")
    end
  end

  describe ".create_label" do
    before do
      stub_post("/projects/3/labels", "label")
      @label = Gitlab.create_label(3, 'Backlog', '#DD10AA')
    end

    it "should get the correct resource" do
      expect(a_post("/projects/3/labels").
             with(:body => {:name => 'Backlog', :color => '#DD10AA'})).to have_been_made
    end

    it "should return information about a created label" do
      expect(@label.name).to eq('Backlog')
      expect(@label.color).to eq('#DD10AA')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-3.5.0 spec/gitlab/client/labels_spec.rb
gitlab-3.4.0 spec/gitlab/client/labels_spec.rb
gitlab-3.3.0 spec/gitlab/client/labels_spec.rb