Sha256: 2b3cddeba2d515c641ad0f54f2370690f8e25aefefc41966f557250ddbf6aef5

Contents?: true

Size: 607 Bytes

Versions: 4

Compression:

Stored size: 607 Bytes

Contents

require 'rails_helper'

describe PgAssociable::Helpers do
  describe '#pg_respond_buscar' do
    let(:user) { create :user }
    let(:ctrl) do
      clazz = Class.new(PgEngine::BaseController)
      clazz.new
    end
    let!(:cosa) { create :cosa }

    before do
      allow(ctrl).to receive_messages(current_user: user, params: { id: 123, query: cosa.id })
      allow(ctrl).to receive(:render)
      ctrl.instance_variable_set(:@clase_modelo, Cosa)
    end

    it do
      ctrl.pg_respond_buscar
      cosas = ctrl.instance_variable_get(:@collection)
      expect(cosas).to eq [cosa]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pg_rails-7.0.6 pg_associable/spec/pg_associable/helpers_spec.rb
pg_rails-7.0.5 pg_associable/spec/pg_associable/helpers_spec.rb
pg_rails-7.0.4 pg_associable/spec/pg_associable/helpers_spec.rb
pg_rails-7.0.3 pg_associable/spec/pg_associable/helpers_spec.rb