Sha256: 7553d29bf8fd9bee3102775ce8ef53bf7c36a73af745ab63bf12c0870bb8bdd8

Contents?: true

Size: 903 Bytes

Versions: 12

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'

describe G5Updatable::SyncsController, type: :controller do
  routes { G5Updatable::Engine.routes }

  describe 'GET index' do
    let(:client){ create(:client) }
    let!(:location) { create(:location, client: client) }
    let!(:location2) { create(:location, client: client) }
    let!(:location3) { create(:location, client: create(:client)) }
    let(:expected_result) { location2.updated_at.in_time_zone.strftime("%I:%M%P on %B %e, %Y") }
    let(:params) { {urn: client.urn } }

    subject do
      get :index, params
      JSON.parse response.body
    end

    its(['updated_at']){ should eq(expected_result) }

    describe "no client" do
      let(:params) { {urn: "xxx" } }

      it "raises" do
        # This error will cause rails to return a 404 in production
        expect{ subject }.to raise_error(ActiveRecord::RecordNotFound)
      end  
    end  
  end
end  

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
g5_updatable-0.10.3 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.10.2 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.10.1 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.10.0 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.9.0 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.8.0 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.7.2 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.7.1 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.7.0 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.6.1 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.6.0 spec/controllers/syncs_controller_spec.rb
g5_updatable-0.5.1 spec/controllers/syncs_controller_spec.rb