t;should find it's own articles" do
>user = User.new
>user.articles.should_receive(:find).with("1")
>user.find_article("1)
> end
> end
>
> This has two benefits:
> - each example is simpler and focuses on one object and how it behaves
&g
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 Nov 28, 2007 11:58 AM, Pito Salas <[EMAIL PROTECTED]> wrote:
> I installed Rspec and am getting the following failure:
>
> $ sudo gem install rspec
> Successfully installed rspec-1.0.8
> Installing ri documentation for rspec-1.0.8...
> Installing RDoc documentation for rspec-1.0.8...
>
> $ spec
On Nov 22, 2007 8:31 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote:
> On Nov 21, 2007 10:22 PM, David Chelimsky <[EMAIL PROTECTED]> wrote:
> >
> > On Nov 21, 2007 3:14 PM, Daniel N <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > >
On Nov 22, 2007 8:22 AM, David Chelimsky <[EMAIL PROTECTED]> wrote:
> On Nov 21, 2007 3:14 PM, Daniel N <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I want to be able to get at the described class in my shared behaviour.
> I'm
> > sure an example wi
edge revision 8175
>
>
>
> On Nov 21, 2007, at 3:14 PM, Daniel N wrote:
>
> > Hi,
> >
> > I want to be able to get at the described class in my shared
> > behaviour. I'm sure an example will say it better than my words
> >
> > describe "m
Hi,
I want to be able to get at the described class in my shared behaviour. I'm
sure an example will say it better than my words
describe "my shared", :shared => true do
it "should tell me what the class is its describing" do
how_do_i_get_the_user_class_here
end
end
describe User do
On Nov 19, 2007 8:24 AM, Scott Taylor <[EMAIL PROTECTED]> wrote:
>
> On Nov 18, 2007, at 4:10 PM, David Chelimsky wrote:
>
> > Hey all,
> >
> > I'm very happy to announce that ActiveReload[1] has generously offered
> > to sponsor a lighthouse[2] account for rspec. We'll be moving ticket
> > tracki
On 10/27/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 10/26/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I just updated my Textmate bundle to the latest in the svn because It
> wasn't
> > working with the latest version of r
Hi,
I just updated my Textmate bundle to the latest in the svn because It wasn't
working with the latest version of rspec. It's been a while since I updated
the bundle ;)
I like the format that I used to have of a progress bar across the top and
html formatted results for each example, however n
On 10/22/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> Thanks to discussions on this list, suggestions from many of you and a
> patch from Pat Maddox, we now have Plain Text User Stories in Story
> Runner.
>
> Read more:
>
>
> http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-
On 9/11/07, s.ross <[EMAIL PROTECTED]> wrote:
>
> I have a story where the user resets the password [hey, this story
> thing really rocks!]. It is expected that the password will change
> and that the user will be redirected to a login screen. A side effect
> is that the user will receive email wit
On 8/24/07, Courtenay <[EMAIL PROTECTED]> wrote:
>
> Does this work?
>
>Image.stub!(:validates_uniqueness_of).and_return(true)
>
>
> On 8/23/07, s.ross <[EMAIL PROTECTED]> wrote:
> > I want to use mocks and stubs to test the controller, but am having
> > trouble getting my validation not to tri
On 8/9/07, Obie Fernandez <[EMAIL PROTECTED]> wrote:
>
> Thanks, Scott. Checking it out now.
>
> On 7/31/07, Scott Taylor <[EMAIL PROTECTED]> wrote:
> >
> > I've just started DatedBackup (an rsnapshot-like utility), which has
> > about 500 LOC at the moment. It is licensed under the GPL, and has
>
On 8/1/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/31/07, Daniel N <[EMAIL PROTECTED]> wrote:
> >
> >
> > On 8/1/07, Scott Taylor <[EMAIL PROTECTED]> wrote:
> > >
> > > I absolutely love the unimplemented spec idea, and ten
On 8/1/07, Scott Taylor <[EMAIL PROTECTED]> wrote:
>
>
> I absolutely love the unimplemented spec idea, and tend to use it a
> lot. But occasionally it gets in my way, when I rush to write a
> spec, and then want to change it to a non-implemented spec. My
> normal solution is to comment out the d
On 7/30/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/30/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > On 7/30/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > > On 7/30/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > > > On 7/30/07,
On 7/30/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/30/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > On 7/30/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > > On 7/30/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> > > > I fi
On 7/30/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/30/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> > I find myself doing the same thing... the, open the model and type in
> > the it shoulds...
> >
> > I ws thinking along the same line... probably all that would be needed
> > is a ra
On 7/30/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
>
> I find myself doing the same thing... the, open the model and type in
> the it shoulds...
I think it would need to do a bit more.
If I call mock_model( User ) and the User class doesn't exist yet that will
blow it up.
I guess at that poi
On 7/30/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
>
> Dear Nathan,
>
> What you are sayiing is correct, and in terms of Ruby on Rails, BDD
> _IS_ View Driven development... or at least it should be IMHO.
>
> At the end of the day, the only thing that matters in a Rails App is
> the Behaviour sh
On 7/28/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/28/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > I'm trying to specify that an action should be rendered with a given
> layout
> > one particular spec.
> >
> > What I've got at t
I'm trying to specify that an action should be rendered with a given layout
one particular spec.
What I've got at the moment is this.
it "should render with the grabber layout" do
controller.should_receive( :render ).with( :layout => "my_layout" )
do_get
end
This doesnt work even tho
On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
Kyle,
That is a good point. We are after the behaviour, not the implementation.
Regards
Mikel
On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
>
> On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote:
On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote:
Daniel N wrote:
> On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
>>
>> There would be a different way.
>>
>> In the idea of "Only test the code you write" all you really need to
&
association rules and then
this can be checked and kept track of when you are refactoring or
changing code.
Hope that helps.
Regards
Mikel
Thanx Mikel.
I didn't even think of using a uniq on the has_many. I was using a
validates_uniquness_of :scope => 'book_id'
I will def
On 7/25/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
> On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > I'm trying to test some code that has validates each and I've got a
very
> str
On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
I'm trying to test some code that has validates each and I've got a very
strange failure
Mock 'Book_1027' expected :store_with_privacy? with (#) but received it with (#)
The Spec
it "should check that a boo
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote:
>
>
> On 24 Jul 2007, at 14:07, Daniel N wrote:
>
> > Any hints as to how to do this without using fixtures?
>
> I did this literally minutes ago. I don
I'm trying to test some code that has validates each and I've got a very
strange failure
Mock 'Book_1027' expected :store_with_privacy? with (#) but received it with (#)
The Spec
it "should check that a book can save a clip" do
@user = mock_model( User, :id => 3 )
@clip = mock_model( Cl
On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote:
On 24 Jul 2007, at 14:07, Daniel N wrote:
> Any hints as to how to do this without using fixtures?
I did this literally minutes ago. I don't use fixtures at all,
ever. Instead I put the data in the before block, eg:
des
Hi,
I'm a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < A
On 7/19/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
Hey all,
I see examples showing up that look like this:
describe Thing do
before(:each) do
@thing = Thing.new
end
it do
@thing.should be_something
end
end
This will produce output like this:
Thing
- should be something
On 7/17/07, Ryan Tucker <[EMAIL PROTECTED]> wrote:
Daniel N wrote:
>
>
> On 7/17/07, *Ryan Tucker* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Daniel N wrote:
> >
> >
> > On 7/17/07, *Ryan Tuc
On 7/17/07, Ryan Tucker <[EMAIL PROTECTED]> wrote:
Daniel N wrote:
>
>
> On 7/17/07, *Ryan Tucker* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Daniel N wrote:
> >
> >
> > On 7/17/07, *Ryan Tuc
On 7/17/07, Ryan Tucker <[EMAIL PROTECTED]> wrote:
Daniel N wrote:
>
>
> On 7/17/07, *Ryan Tucker* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Ryan Tucker wrote:
> > Thank you in advance for your help. I am relatively new to b
On 7/17/07, Ryan Tucker <[EMAIL PROTECTED]> wrote:
Ryan Tucker wrote:
> Thank you in advance for your help. I am relatively new to both Rails
> and Rspec and I am hoping for some insight from some experienced
veterans.
>
> Right now I am using Rspec for code that has already been written so
> t
On 7/16/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/15/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
>
> On 7/16/07, Daniel N <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > On 7/15/07, David Chelimsky < [EMAIL PROTECTE
On 7/16/07, Daniel N <[EMAIL PROTECTED]> wrote:
On 7/15/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/14/07, Daniel N <[EMAIL PROTECTED]> wrote:
> >
> >
> > On 7/15/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > > O
On 7/15/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/14/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
> On 7/15/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > On 7/14/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> &
On 7/15/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/14/07, Daniel N <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've just started to try and spec my application.html.erb layout as one
of
> the view specs but it totally barfs.
>
> I'm guessing that it
Hi,
I've just started to try and spec my application.html.erb layout as one of
the view specs but it totally barfs.
I'm guessing that it's due to the yield statements in the layout.
Any clues as to how to proceed?
Cheers
Daniel
___
rspec-users mailin
My Bad... Please ignore
On 7/10/07, Daniel N <[EMAIL PROTECTED]> wrote:
Hi,
I'm trying to setup a mock for my controller test but I can't get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
Hi,
I'm trying to setup a mock for my controller test but I can't get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
).and_return([EMAIL PROTECTED])
do_get
end
and in the controller
@users = User.find(:all, :limit => 10
I want to extract the method for logging in so that I don't have to include
it in each before call.
Is it bad to use a describe block within the rspec_helper in a rails project
for controller tests?
I have in my spec_helper.rb
describe "an authenticated request", :shared => true do
before( :ea
On 7/6/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/6/07, Daniel N <[EMAIL PROTECTED]> wrote:
> On 7/6/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > On 7/6/07, David Chelimsky < [EMAIL PROTECTED]> wrote:
> > > On 7/5/07, Daniel N <[EMAIL PROTE
On 7/6/07, Daniel N <[EMAIL PROTECTED]> wrote:
On 7/6/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On 7/5/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I'm very new to rspec so please be patient with me.
> >
> > I
On 7/6/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
>
> On 7/6/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > On 7/3/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I'm very new to rspec, so if this is not th
On 7/6/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/3/07, Daniel N <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm very new to rspec, so if this is not the right forum please let me
> know.
>
> I'm starting to spec my models first in an existing rails
On 7/6/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/5/07, Daniel N <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm very new to rspec so please be patient with me.
>
> I've tried to take some of my tests out of the controller specs to check
for
> things th
Hi,
I'm very new to rspec so please be patient with me.
I've tried to take some of my tests out of the controller specs to check for
things that are rendered.
This has not worked so well, since my views have the controller method
current_user
in quite a few places.
Is there any way that I ca
Hi,
I'm very new to rspec, so if this is not the right forum please let me know.
I'm starting to spec my models first in an existing rails app, porting from
a mix of Test::Unit, and simply_bdd amongst others.
I'm at the point where I want to test that certain associations are
present. What I'm
52 matches
Mail list logo