Sha256: b6cd51aac29312d9455c62a3e487f18a35cd36f14312c73fa9ffac2c5726c91c

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

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

4 entries across 4 versions & 1 rubygems

Version Path
jiralicious-0.3.0 spec/search_spec.rb
jiralicious-0.2.2 spec/search_spec.rb
jiralicious-0.2.1 spec/search_spec.rb
jiralicious-0.2.0 spec/search_spec.rb