NewMonarch (owner)

Fork Of

Revisions

gist: 223330 Download_button fork
public
Public Clone URL: git://gist.github.com/223330.git
Embed All Files: show embed
My action.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  def index
    @assets = current_account.assets.paginate :page => params[:page], :per_page => 10
  end
 
# How to spec this???
before(:each) do
  @account = Account.new
  @assets = [Asset.new(:account => @account)]
end
it "should paginate the assets"
  @controller.should_receive(:current_account).and_return(@account)
  @account.should_receive(:assets).and_return(@assets)
  @assets.should_receive(:paginate)
end
traditional.rb #
1
2
3
4
5
6
7
8
9
10
11
12
# controller action ..
 
def index
  @tasks = Task.all
end
 
# spec ....
describe :get => :index do
 
  expects :find, :on => Task, :with => :all, :returns => mock_task
  should_assign_to :tasks, :with => mock_task
end