On 4.12.2007, at 8.40, Fischer, Daniel wrote:
> Sorry for so many messages, I hope I don't get in trouble for this.
> Maybe IRC would be better if there was a RSpec one.
#rspec @freenode
//jarkko
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http:
Sorry for so many messages, I hope I don't get in trouble for this. Maybe
IRC would be better if there was a RSpec one.
Anyway, the previous problem was solved with the following
http://pastie.textmate.org/private/m6qqfd7tzeanw2yar8rua
The problem was caused by :
@user = mock_model(User, :wri
Alright, thanks, I'm getting more progress in this. As soon as I figure this
out I won't have too many problems.. hopefully.
Anyone know what "undefined method `call' for "1":String" means?
I'm trying to do this:
http://pastie.textmate.org/private/17jjjmbave0ph2mkcgp6w
On Dec 3, 2007 9:33 PM, D
didnt mean to confuse, i'm asking about the code in the body of the
email. The pastie was just for background reference.
--J
On Dec 4, 2007, at 12:41 AM, Jonathan Linowes wrote:
> I want to isolate and spec methods that are shared by controllers,
> and live in application.rb.
>
> Whereas I usua
I want to isolate and spec methods that are shared by controllers,
and live in application.rb.
Whereas I usually also provide examples in individual controllers
that use these methods, not necessarily all the edge cases and I'd
like to isolate the examples.
This is the approach I'm taking (
On Dec 3, 2007 10:26 PM, Fischer, Daniel <[EMAIL PROTECTED]> wrote:
> Hey cool, thanks for the help guys. One problem though, when I take this
> approach I can't decouple the specs anymore. They all "User_xxx receive
> unexpected message :articles". It seems silly to include all behaviors in
> one
I also have another problem, when I am trying to do the similar strategy for
XML based speccing it fails on saying nil.to_xml
Arg..
And all it is, is the following => (with a before_filter on login required)
but still, it's just current_user.
def show
@writing = current_user.writings.find(p
Hey cool, thanks for the help guys. One problem though, when I take this
approach I can't decouple the specs anymore. They all "User_xxx receive
unexpected message :articles". It seems silly to include all behaviors in
one spec, or put that expectation in each test. Is there a way around this?
Than
On 3.12.2007, at 21.23, David Chelimsky wrote:
> On Dec 3, 2007 1:18 PM, Jarkko Laine <[EMAIL PROTECTED]> wrote:
>>
>> On 3.12.2007, at 21.05, Nathan Sutton wrote:
>>
>>> Department.stub!(:find_by_code).with("75").and_return("3")
>>
>> You can't use with() with stub! (only with should_receive), s
It's worked since I started using rspec, but I started relatively
recently, and only on edge.
Nathan Sutton
[EMAIL PROTECTED]
rspec edge revision 3014
rspec_on_rails edge revision 3014
rails edge revision 8238
On Dec 3, 2007, at 1:23 PM, David Chelimsky wrote:
> On Dec 3, 2007 1:18 PM, Jark
On Dec 3, 2007 1:18 PM, Jarkko Laine <[EMAIL PROTECTED]> wrote:
>
> On 3.12.2007, at 21.05, Nathan Sutton wrote:
>
> > Department.stub!(:find_by_code).with("75").and_return("3")
>
> You can't use with() with stub! (only with should_receive), so just
> leave it away:
>
> Department.stub!(:find_by_co
On 3.12.2007, at 21.05, Nathan Sutton wrote:
> Department.stub!(:find_by_code).with("75").and_return("3")
You can't use with() with stub! (only with should_receive), so just
leave it away:
Department.stub!(:find_by_code).and_return("3")
//jarkko
--
Jarkko Laine
http://jlaine.net
http://doth
Department.stub!(:find_by_code).with("75").and_return("3")
Nathan Sutton
[EMAIL PROTECTED]
rspec edge revision 3014
rspec_on_rails edge revision 3014
rails edge revision 8238
On Dec 3, 2007, at 12:33 PM, Sahyoun wrote:
> Hello,
>
> I'm confused why the spec described below is failing. Other
Hello,
I'm confused why the spec described below is failing. Other simple
comparison specs are passing fine for the same model. The code is working
accordingly when I test it through the console, I'm just having difficulty
getting this spec to work. Any pointers would be appreciated.
Failure mess
Well, I kinda like the word given, however I feel it's competing with the
Context in describe Class, "Context" do
Maybe before should be replaced with some givens and expectations, like so:
describe Class, "Context" do
given do
end
always_expect do
end
it "should ..." do
end
e
The code works fine. I was asking about the "given" thing.
Daniel
On 3 Dec 2007, at 13:32 3 Dec 2007, Bryan Liles wrote:
>
> On Nov 29, 2007, at 5:54 AM, Daniel Tenner wrote:
>
>> What are people's opinions on which of these two styles is better to
>> use?
>>
>>
>> it "should be possible to di
On Nov 29, 2007, at 5:54 AM, Daniel Tenner wrote:
> What are people's opinions on which of these two styles is better to
> use?
>
>
> it "should be possible to disable the number" do
> given(valid_sms_user) do |user|
> user.save
> user.disable_number
> user.should be_disab
Well, if articles is already scoped, you just say:
user.should_receive('articles').and_return(some_articles)
To make sure your articles method is scoped, write a model test that hits
the database, and verify that only the user's articles are returned.
As Daniel Tenner says, you should try to kee
Hi Daniel,
You're trying to do too much in the controller. It's not the
controller's responsibility to ensure that the user is capable of
returning its own article without including anyone else's - that's
the user's (or the Article model's, perhaps) responsibility. Your
controller should
Assuming that there is a call like this in your controller
@articles = current_user.articles
One way to do this is to stub out the controller.current_user to return a
mock object of the current_user
Then put an expectation on the current user that it's articles method gets
called. (return a mocke
On 3.12.2007, at 11.57, Fischer, Daniel wrote:
> Let's say you're using the restful_authentication plugin.
>
> You have a model called articles. On the index action of the
> articlescontroller you simply want to spec out that it'll scope the
> results to the ownership of the current_user.
>
>
yuck, that seems kind of nasty, no?
user.articles is already scoped...
There has to be a different solution!
On Dec 3, 2007 2:07 AM, Stefan Magnus Landrø <[EMAIL PROTECTED]>
wrote:
> Typically, I'd write a method in your user model that returns the user's
> articles:
>
> class User do
>
> def
Typically, I'd write a method in your user model that returns the user's
articles:
class User do
def find_articles_for_user
Article.find(:all, :conditions => ['userid = ?', id)
end
end
Then you'd use a mock in your controller spec, and make sure you test that
your method is being called.
Let's say you're using the restful_authentication plugin.
You have a model called articles. On the index action of the
articlescontroller you simply want to spec out that it'll scope the results
to the ownership of the current_user.
It should NOT include any articles other than the articles that u
Let's say you're using the restful_authentication plugin.
You have a model called articles. On the index action of the
articlescontroller you simply want to spec out that it'll scope the results
to the ownership of the current_user.
It should NOT include any articles other than the articles that u
25 matches
Mail list logo