> It just looks as if (based on logs) that no database call is made in the
> real application when I make this call with rspec (although it works ok
> without rspec)
> products = find_all_by_category_id(category_id)
> The error is generated in the statement following the above statement
> product
> Sorry again I forgot to add the last statement
Could you just copy and paste your code? That would be infinitely more helpful.
Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky wrote:
> On Mon, Aug 11, 2008 at 2:49 PM, John Mark <[EMAIL PROTECTED]> wrote:
>>> product = mock_model(Product, :id => 1, :category_id => 1)
>>>
>>> Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
>>>
>>> Product.should_receive(:find_all_meetin
On Mon, Aug 11, 2008 at 2:49 PM, John Mark <[EMAIL PROTECTED]> wrote:
> David Chelimsky wrote:
>> On Mon, Aug 11, 2008 at 1:47 PM, John Mark <[EMAIL PROTECTED]> wrote:
>>>
>>> Sorry that was a typo
>>>
>>> Its actually stub! in my code
>>
>> The original example doesn't seem to do anything:
>>
>> i
David Chelimsky wrote:
> On Mon, Aug 11, 2008 at 1:47 PM, John Mark <[EMAIL PROTECTED]> wrote:
>>
>> Sorry that was a typo
>>
>> Its actually stub! in my code
>
> The original example doesn't seem to do anything:
>
> it "should find products given a category" do
> product = mock_model(Product,
On 07/08/2008, at 05:04 , Jonathan Linowes wrote:
> .should be_bag_of( [1, 3, 1, 4, 2] )
+1
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On Mon, Aug 11, 2008 at 1:47 PM, John Mark <[EMAIL PROTECTED]> wrote:
> David Chelimsky wrote:
>> On Mon, Aug 11, 2008 at 1:31 PM, Craig Demyanovich
>> <[EMAIL PROTECTED]> wrote:
>>> Looks like this line
>>>
>>> Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
>>>
>>> m
David Chelimsky wrote:
> On Mon, Aug 11, 2008 at 1:31 PM, Craig Demyanovich
> <[EMAIL PROTECTED]> wrote:
>> Looks like this line
>>
>> Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
>>
>> might be the culprit. It should be stub!(find... instead of stub(!find
>
>
On Mon, Aug 11, 2008 at 1:31 PM, Craig Demyanovich
<[EMAIL PROTECTED]> wrote:
> Looks like this line
>
> Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
>
> might be the culprit. It should be stub!(find... instead of stub(!find
Actually, stub!(:find
>
> Regar
And i think that stubbed classes or objects can not access the database.
On Mon, Aug 11, 2008 at 3:31 PM, Craig Demyanovich
<[EMAIL PROTECTED]> wrote:
> Looks like this line
>
> Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
>
> might be the culprit. It should be stu
On Mon, Aug 11, 2008 at 1:27 PM, John Mark <[EMAIL PROTECTED]> wrote:
> The statement
> products = find_all_by_category_id(category_id)
> in the Product model is returning nil with rspec.
> I am expecting it to to return value for the stub that I provided it
> with. It does
> not also work with fix
Looks like this line
Product.stub(!find_all_by_category_id).with(anything()).and_return([product])
might be the culprit. It should be stub!(find... instead of stub(!find
Regards,
Craig
___
rspec-users mailing list
rspec-users@rubyforge.org
http://r
The statement
products = find_all_by_category_id(category_id)
in the Product model is returning nil with rspec.
I am expecting it to to return value for the stub that I provided it
with. It does
not also work with fixtures.
Product model
def self.find_all_meeting_some_criteria_for_category(cate
Would such a matcher also work in this instance:
Car.should_receive(:find).with([EMAIL PROTECTED], @fiat.id])
Such that if I don't know (or care) what order the IDs will be passed to
the find method, this will pass?
Or is there already some other way to achieve that?
--
Posted via http://www.r
On Mon, Aug 11, 2008 at 2:05 AM, Yury Kotlyarov <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I have a view:
>
> <% restrict_to 'admin' do %>
>
> <%= render :partial => 'detail' %>
>
> <% end %>
>
> What's the best way to spec view in this case - I just want to yield block
> in restrict_to call.
Here
Hi!
I have a view:
<% restrict_to 'admin' do %>
<%= render :partial => 'detail' %>
<% end %>
What's the best way to spec view in this case - I just want to yield
block in restrict_to call.
Thanks in advance,
Yury
___
rspec-users mailing list
16 matches
Mail list logo