Sha256: ba4fbd164821755174f37e72441d1d008f78b17275671f709876356355db0254

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 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
  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

3 entries across 3 versions & 1 rubygems

Version Path
jiralicious-0.5.0 spec/search_spec.rb
jiralicious-0.4.3 spec/search_spec.rb
jiralicious-0.4.0 spec/search_spec.rb