File: http_error_spec.rb

package info (click to toggle)
ruby-jira 2.1.5-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 968 kB
  • sloc: ruby: 5,125; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper'

describe JIRA::HTTPError do
  let(:response) do
    response = double('response')
    allow(response).to receive(:code).and_return(401)
    allow(response).to receive(:message).and_return('A MESSAGE WOO')
    response
  end

  subject { described_class.new(response) }

  it 'takes the response object as an argument' do
    expect(subject.response).to eq(response)
  end

  it 'has a code method' do
    expect(subject.code).to eq(response.code)
  end

  it 'returns code and class from message' do
    expect(subject.message).to eq(response.message)
  end
end