Sha256: 38359783a3a23efed191e429d5f4289074d66c97bc63a3e972dedbda65278756
Contents?: true
Size: 913 Bytes
Versions: 18
Compression:
Stored size: 913 Bytes
Contents
require "spec_helper" RSpec.describe Endpoints::Schema do include Rack::Test::Methods let(:schema_filename) { "#{Config.root}/schema/schema.json" } subject(:get_schema) { get "/schema.json" } context "without a schema.json" do before do allow(File).to receive(:exists?).and_return(false) end it "raises a 404 on missing schema" do assert_raises(Pliny::Errors::NotFound) do get_schema end end end context "with a schema.json" do let(:contents) { "contents" } before do allow(File).to receive(:exists?).and_return(true) allow(File).to receive(:read).and_return(contents) end it "returns the schema is present" do get_schema assert_equal 200, last_response.status assert_equal "application/schema+json", last_response.headers["Content-Type"] assert_equal contents, last_response.body end end end
Version data entries
18 entries across 18 versions & 1 rubygems