Sha256: 673c6f971f6d6b8e387459c54fe37fa86a8d98e1b125964988320f3312432dd0

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

require 'spec_helper'

RSpec.describe Rails::Service::StatusController, type: :controller do
  routes { Rails::Service::Engine.routes }

  it 'renders root status endpoint' do
    time = Time.current
    expect(Time).to receive(:current).and_return(time)
    get :index
    expect(response).to have_http_status :ok
    expect(response.body).to eq({ status: 'ok', time: time }.to_json)
  end

  it 'renders custom status endpoints from lib/service/status/actions.rb' do
    get :db
    expect(response).to have_http_status :ok
    status_hash = JSON.parse(response.body)
    expect(status_hash['status']).to eq 'ok'
    expect(status_hash['time']).to be_kind_of(Float)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-service-0.2.0 spec/controllers/status_controller_spec.rb
rails-service-0.1.0 spec/controllers/status_controller_spec.rb