On Nov 4, 2008, at 3:46 PM, Fernando Perez wrote:
Are the docs on mock outdated? I sometimes see mock_model, and
sometimes
mock. Which one should be used?
mock_model is for ActiveRecord objects. it's just a mock() call with
a random id stub set, and a :new_record? => false
Scott
_
Ok I get it. I was wondering why mock_model was not showing up in
rspec's rdoc. Thanks for the clarification.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-us
Crap! I was stubbing Product, instead of Site! It all works now. Matt's
typo put me on the track!
But I will definitely use the trick Spec::Runner.configure do
|config|...
to avoid having to type this stub in all my files.
Thanks.
--
Posted via http://www.ruby-forum.com/.
On 4 Nov 2008, at 20:46, Fernando Perez wrote:
Are the docs on mock outdated? I sometimes see mock_model, and
sometimes
mock. Which one should be used?
For mock_model, you need to look at the rspec-rails gem, which is a
separate library.
You actually have three choices when mocking an Ac
Are the docs on mock outdated? I sometimes see mock_model, and sometimes
mock. Which one should be used?
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
> That work?
It could. But in such case, how will I test my before_filter
independently?
My real problem is to stub the find_by_domain_name instance method.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.
On 4 Nov 2008, at 19:38, Fernando Perez wrote:
Here is my spec:
--
describe Admin::ProductsController, "A visitor wants to access
admin/products" do
before(:each) do
@product = mock_model(Product, :traffic_available => 0)
Product.stub!(:find_by_domain_name).and_return(@product)
Should t
On Tue, Nov 4, 2008 at 1:38 PM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> Here is my spec:
> --
> describe Admin::ProductsController, "A visitor wants to access
> admin/products" do
>
> before(:each) do
>@product = mock_model(Product, :traffic_available => 0)
>Product.stub!(:find_by_doma
Here is my spec:
--
describe Admin::ProductsController, "A visitor wants to access
admin/products" do
before(:each) do
@product = mock_model(Product, :traffic_available => 0)
Product.stub!(:find_by_domain_name).and_return(@product)
end
it "should redirect to login path" do
get :