Sha256: 92071628691500416fd187a302d5f96df0593edd2e42903beab7b465531aa3c5

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 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.api_version = "latest"
    end
  end

  context "when successful" do
    before :each do
      FakeWeb.register_uri(:post,
                           "#{Jiralicious.rest_path}/search",
                           :status => "200",
                           :body => search_json)

    end

    it "instantiates a search result" do
      results = Jiralicious.search("key = HSP-1")
      results.should be_instance_of(Jiralicious::SearchResult)
    end
  end

  context "When there's a problem with the query" do
    before :each do
      FakeWeb.register_uri(:post,
                           "#{Jiralicious.rest_path}/search",
                           :body => "{errorMessages: ['error']}",
                           :status => "400")
    end

    it "raises an exception" do
      lambda {
        results = Jiralicious.search("key = HSP-1")
      }.should raise_error(Jiralicious::JqlError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jiralicious-0.1.0 spec/search_spec.rb