Skip to content

Instantly share code, notes, and snippets.

@seeflanigan
Created December 14, 2010 17:43
Show Gist options
  • Save seeflanigan/740770 to your computer and use it in GitHub Desktop.
Save seeflanigan/740770 to your computer and use it in GitHub Desktop.
PublicController
class PublicController < ApplicationController
assume(:search) { Game.search(params[:search]) }
assume(:results) { search.current_scope }
assume(:user_games) { current_user.games }
def index
end
end
describe PublicController do
describe "when searching for games" do
let(:game) { Factory(:game) }
before(:each) { post :index, :search => {:name_like => game.name.downcase } }
it "returns the expected game(s)" do
controller.results.should == [game]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment