Sha256: 5eb5a4e8b2c53ac9c5807c8289848c647be1eedaaaeea210839c6b8fb359e7d7

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

require 'spec_helper'

describe UsersController, type: :controller do
  describe 'injected relations' do
    it 'exposes relation without required params' do
      get :index

      expect(controller.users).to eql(rom.read(:users).index.to_a)
    end

    it 'exposes relation with required params' do
      get :search, name: 'Jane'

      expect(controller.users).to eql(rom.read(:users).by_name('Jane').to_a)
    end

    it 'halts processing when required params are missing' do
      get :search

      expect(response.status).to be(400)
    end

    it 'skips injecting relation when :only option is used' do
      get :ping

      expect(controller.users).to be(nil)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-rails-0.3.0.beta1 spec/dummy/spec/controllers/users_controller_spec.rb
rom-rails-0.2.1 spec/dummy/spec/controllers/users_controller_spec.rb
rom-rails-0.2.0 spec/dummy/spec/controllers/users_controller_spec.rb