Sha256: bbf570f03bc3bae16d81f5b353f1d6138dd5f0bdd639e05fdedd821d961d0389
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
# encoding: utf-8 require "spec_helper" module Okei describe "Getting unit"do # ========================================================================== # Prepare environment # ========================================================================== let!(:unit) { create :unit } # ========================================================================== # Prepare variables # ========================================================================== def call_request(uuid) get "okei/api/v1/units/#{ uuid }" end # ========================================================================== # Run tests # ========================================================================== context "with proper uuid" do before { call_request unit.uuid } it "responds with 200" do expect(response.status).to eq 200 end it "responds with proper json" do expect(response.body).to match_json_schema(:get_unit) end it "responds with requested unit" do received = JSON.parse(response.body)["unit"] expect(received["uuid"]).to eq unit.uuid end end context "with wrong uuid" do before { call_request "00000000-0000-0000-0000-000000000000" } it "responds with 404" do expect(response.status).to eq 404 end it "responds with proper json" do expect(response.body).to match_json_schema(:get_errors) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
okei-1.0.2 | spec/requests/okei/api/v1/get_unit_spec.rb |
okei-1.0.1 | spec/requests/okei/api/v1/get_unit_spec.rb |
okei-1.0.0 | spec/requests/okei/api/v1/get_unit_spec.rb |