Sha256: bb06724da1074f6022b67ae0c955646e9153e64f9d82991116aaf60a95fbb73f
Contents?: true
Size: 1.35 KB
Versions: 9
Compression:
Stored size: 1.35 KB
Contents
require "spec_helper" class EventsController < Alchemy::Admin::ResourcesController end describe EventsController do it "should include ResourcesHelper" do expect(controller.respond_to?(:resource_window_size)).to be_truthy end describe '#index' do let(:params) { Hash.new } let(:peter) { Event.create(name: 'Peter') } let(:lustig) { Event.create(name: 'Lustig') } before do sign_in(admin_user) peter; lustig end it "returns all records" do get :index, params expect(assigns(:events)).to include(peter) expect(assigns(:events)).to include(lustig) end context 'with search query given' do let(:params) { {query: 'PeTer'} } it "returns only matching records" do get :index, params expect(assigns(:events)).to include(peter) expect(assigns(:events)).not_to include(lustig) end context "but searching for record with certain association" do let(:bauwagen) { Location.create(name: 'Bauwagen') } let(:params) { {query: 'Bauwagen'} } before do peter.location = bauwagen peter.save end it "returns only matching records" do get :index, params expect(assigns(:events)).to include(peter) expect(assigns(:events)).not_to include(lustig) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems