search for: post_proxy

Displaying 2 results from an estimated 2 matches for "post_proxy".

2007 Oct 06
4
spec''ing views, mock_model associations
I writing a spec that returns the count of how many players in a game: it "should how many players in a link to all players" do render :partial =>"games/game", :object => @game response.should have_tag(''a'',"(2) Players") end I''m not sure how to do the mock model, I think it would be done two ways but unsure of the syntax: 1: add
2007 Oct 05
7
Easy AR association stubbing
...;ve added a method to the mock class that makes it pretty easy to stub associations in rails. I''ve been using it for awhile and it seems to cut down on a lot of setup code for the controller and model specs that use associations. #before @person = mock_model(Person) posts = mock(''post_proxy'') posts.stub!(:build).and_return(mock_model(Post, :save => true)) @person.stub!(:posts).and_return(posts) # now @person = mock_model(Person) @person.stub_association!(:posts, :find_by_title => mock_model(Post)) Just add this to the spec helper module Spec module Mocks modu...