Sha256: 4287c850fd516322ac666cc470e42c656f85b974ce65ed57176083dfd6c6853d

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 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://jstewart:topsecret@localhost"
      config.auth_type = :basic
      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.5.0 spec/watchers_spec.rb
jiralicious-0.4.3 spec/watchers_spec.rb
jiralicious-0.4.0 spec/watchers_spec.rb