Sha256: dd81960976f836a394ac4a45ae79c9a637ac9a6815d85676df42758d0f6143a8
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
# encoding: utf-8 require "spec_helper" module Okei module Api module V1 describe Responder do routes { Okei::Engine.routes } describe "#on_success" do controller(UnitsController) { def index; on_success :units; end } before { get :index, format: :json } it "sets @units" do expect(assigns(:units)).to eq :units end it "renders 'index'" do expect(response).to render_template "index" end it "responds with 200" do expect(response.status).to eq 200 end end describe "#on_found" do controller(UnitsController) { def index; on_found :unit; end } before { get :index, format: :json } it "sets @unit" do expect(assigns(:unit)).to eq :unit end it "renders 'index'" do expect(response).to render_template "show" end it "responds with 200" do expect(response.status).to eq 200 end end describe "#on_not_found" do controller(UnitsController) do def index; on_not_found :messages; end end before { get :index, format: :json } it "sets @messages" do expect(assigns(:messages)).to eq :messages end it "renders 'errors'" do expect(response).to render_template "errors" end it "responds with 404" do expect(response.status).to eq 404 end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
okei-1.0.0 | spec/controllers/okei/api/v1/responder_spec.rb |
okei-1.0.0.pre.rc | spec/controllers/okei/api/v1/responder_spec.rb |
okei-0.0.2 | spec/controllers/okei/api/v1/responder_spec.rb |