Sha256: fa6f05808804381e33f67f28aa1e06a036a3fb626e27aa5f6b95eb76f27fc68e

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

require "spec_helper"

describe Shamu::JsonApi::ErrorBuilder do
  let( :builder ) { Shamu::JsonApi::ErrorBuilder.new }

  describe "#summary" do
    it "infers title" do
      builder.summary 422, :not_allowed

      expect( builder.compile ).to include title: "Not Allowed"
    end
  end

  describe "#exception" do
    before( :each ) do
      builder.exception NotImplementedError.new( "Nope, we haven't done that yet" )
    end

    it "applies message to details" do
      expect( builder.compile ).to include detail: "Nope, we haven't done that yet"
    end

    it "applies class name as code" do
      expect( builder.compile ).to include code: "not_implemented"
    end

    it "applies class name as title" do
      expect( builder.compile ).to include title: "Not Implemented"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shamu-0.0.4 spec/lib/shamu/json_api/error_builder_spec.rb
shamu-0.0.3 spec/lib/shamu/json_api/error_builder_spec.rb