Sha256: 0fac876f0a0e2c31b4d58a25d9c0c76f6a6e70368a6473d26436a0cc36fe849d

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8
require "spec_helper"

describe Jiralicious, "search" do

  before :each do
    Jiralicious.configure do |config|
      config.username = "jstewart"
      config.password = "topsecret"
      config.uri = "http://localhost"
      config.auth_type = :cookie
      config.api_version = "latest"
    end

    FakeWeb.register_uri(:get,
      "#{Jiralicious.rest_path}/issue/EX-1/watchers/",
      :status => "200",
      :body => watchers_json)
    FakeWeb.register_uri(:post,
      "#{Jiralicious.rest_path}/issue/EX-1/watchers/",
      :status => "204")
    FakeWeb.register_uri(:delete,
      "#{Jiralicious.rest_path}/issue/EX-1/watchers/?username=fred",
      :status => "204")
  end

  it "finds by issue key" do
    watchers = Jiralicious::Issue::Watchers.find_by_key("EX-1")
    watchers.should be_instance_of(Jiralicious::Issue::Watchers)
    watchers.watchers.count.should == 1
    watchers.watchers[0]['name'].should == "fred"
  end

  it "adds a new watcher" do
    response = Jiralicious::Issue::Watchers.add("fred", "EX-1")
    response.response.class.should == Net::HTTPNoContent
  end

  it "removes a watcher" do
    response = Jiralicious::Issue::Watchers.remove("fred", "EX-1")
    response.response.class.should == Net::HTTPNoContent
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jiralicious-0.3.0 spec/watchers_spec.rb
jiralicious-0.2.2 spec/watchers_spec.rb
jiralicious-0.2.1 spec/watchers_spec.rb