Re: [rspec-users] Need help to figure out why this expectation isn't met.

2010-10-26 Thread Haim Ashkenazi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Chris, On Oct 26, 2010, at 11:15 AM, Chris Mear wrote: > > On 25 Oct 2010, at 09:54, Haim Ashkenazi wrote: > >> On Oct 25, 2010, at 9:09 AM, Haim Ashkenazi wrote: >> >>> Hi >>> >>> This is my first ruby script, so sorry if it's trivial :) >>>

Re: [rspec-users] Need help to figure out why this expectation isn't met.

2010-10-26 Thread Chris Mear
On 25 Oct 2010, at 09:54, Haim Ashkenazi wrote: > On Oct 25, 2010, at 9:09 AM, Haim Ashkenazi wrote: > >> Hi >> >> This is my first ruby script, so sorry if it's trivial :) >> >> I have a should_receive expectation on :new which should work (and works on >> a simple test I wrote) but it doesn

Re: [rspec-users] Need help to figure out why this expectation isn't met.

2010-10-25 Thread Haim Ashkenazi
Hi I'm not sure if the URLs in the original post can be viewed :( so here they are: The repository is here: http://github.com/babysnakes/runssh The spec with the problem is http://github.com/babysnakes/runssh/blob/5197b763f391d6d358ca7bc5838375c9247271d8/spec/runsshlib/cli_spec.rb (line 127).

[rspec-users] Need help to figure out why this expectation isn't met.

2010-10-25 Thread Haim Ashkenazi
Hi This is my first ruby script, so sorry if it's trivial :) I have a should_receive expectation on :new which should work (and works on a simple test I wrote) but it doesn't work in my case and I can't figure out why. The source is on github (commit: 5197b763f391d6d358ca7bc5838375c9247271d8).

Re: [rspec-users] Need Help with Specs failing when using ActionMailer

2010-01-20 Thread Brad
Finally solved the problem. Even though the application is Rails 2.3.5 it was started on a much earlier version and the view files were using the old rhtml extensions. The newer auto format detection uses html.erb, or in the case of the mailer, likes file_name.text.html.erb. All I had to do was

Re: [rspec-users] Need Help with Specs failing when using ActionMailer

2009-12-10 Thread Brad
Dave Thanks for looking at this. I really appreciate it. Here is the method being called: 144 # Sign up a new user with a default role of USER and with a state of pending. 145 # The user must activate their account via e-mail before they can login 146 def self.create_from_signup(params = {} )

Re: [rspec-users] Need Help with Specs failing when using ActionMailer

2009-12-10 Thread David Chelimsky
On Wed, Dec 9, 2009 at 7:48 PM, Brad wrote: > No one was able to help me with the last post so I thought I would try > again with more details.  I am having problems with specs that invoke > the mailer.  My User model has a method that invokes a mailer as part > of the create_from_signup method. >

[rspec-users] Need Help with Specs failing when using ActionMailer

2009-12-09 Thread Brad
No one was able to help me with the last post so I thought I would try again with more details. I am having problems with specs that invoke the mailer. My User model has a method that invokes a mailer as part of the create_from_signup method. First an example of the test that passes in my spec/m

Re: [rspec-users] Need Help

2009-10-07 Thread David Chelimsky
On Wed, Oct 7, 2009 at 4:18 PM, Andrew Premdas wrote: > 2009/10/7 David Chelimsky >> >> On Wed, Oct 7, 2009 at 3:57 PM, aslak hellesoy >> wrote: >> > >> > >> > On Wed, Oct 7, 2009 at 10:24 PM, Andrew Premdas >> > wrote: >> >> >> >> 2009/9/25 Mithun Perera >> >>> >> >>> Mithun Perera wrote: >>

Re: [rspec-users] Need Help

2009-10-07 Thread Andrew Premdas
2009/10/7 David Chelimsky > On Wed, Oct 7, 2009 at 3:57 PM, aslak hellesoy > wrote: > > > > > > On Wed, Oct 7, 2009 at 10:24 PM, Andrew Premdas > wrote: > >> > >> 2009/9/25 Mithun Perera > >>> > >>> Mithun Perera wrote: > >>> > Mithun Perera wrote: > >>> >> Hi all, > >>> >> I am an university

Re: [rspec-users] Need Help

2009-10-07 Thread Andrew Premdas
2009/10/7 aslak hellesoy > > > On Wed, Oct 7, 2009 at 10:24 PM, Andrew Premdas wrote: > >> 2009/9/25 Mithun Perera >> >>> Mithun Perera wrote: >>> > Mithun Perera wrote: >>> >> Hi all, >>> >> I am an university student and these days i am on training period. So >>> i >>> >> want to know about ru

Re: [rspec-users] Need Help

2009-10-07 Thread David Chelimsky
On Wed, Oct 7, 2009 at 3:57 PM, aslak hellesoy wrote: > > > On Wed, Oct 7, 2009 at 10:24 PM, Andrew Premdas wrote: >> >> 2009/9/25 Mithun Perera >>> >>> Mithun Perera wrote: >>> > Mithun Perera wrote: >>> >> Hi all, >>> >> I am an university student and these days i am on training period. So >>>

Re: [rspec-users] Need Help

2009-10-07 Thread aslak hellesoy
On Wed, Oct 7, 2009 at 10:24 PM, Andrew Premdas wrote: > 2009/9/25 Mithun Perera > >> Mithun Perera wrote: >> > Mithun Perera wrote: >> >> Hi all, >> >> I am an university student and these days i am on training period. So i >> >> want to know about ruby on on rails "cucumber and Rspec". If some

Re: [rspec-users] Need Help

2009-10-07 Thread Andrew Premdas
2009/9/25 Mithun Perera > Mithun Perera wrote: > > Mithun Perera wrote: > >> Hi all, > >> I am an university student and these days i am on training period. So i > >> want to know about ruby on on rails "cucumber and Rspec". If somebody > >> know about these fields please help me. If not please s

Re: [rspec-users] Need Help

2009-09-25 Thread Matt Wynne
On 25 Sep 2009, at 08:07, Mithun Perera wrote: Mithun Perera wrote: Mithun Perera wrote: Hi all, I am an university student and these days i am on training period. So i want to know about ruby on on rails "cucumber and Rspec". If somebody know about these fields please help me. If not pl

Re: [rspec-users] Need Help

2009-09-25 Thread Mithun Perera
Mithun Perera wrote: > Mithun Perera wrote: >> Hi all, >> I am an university student and these days i am on training period. So i >> want to know about ruby on on rails "cucumber and Rspec". If somebody >> know about these fields please help me. If not please send me an >> tutorials for basic funct

Re: [rspec-users] Need Help

2009-09-22 Thread Matt Wynne
On 22 Sep 2009, at 06:34, Mithun Perera wrote: Mithun Perera wrote: Hi all, I am an university student and these days i am on training period. So i want to know about ruby on on rails "cucumber and Rspec". If somebody know about these fields please help me. If not please send me an tutorial

Re: [rspec-users] Need Help

2009-09-21 Thread Mithun Perera
Mithun Perera wrote: > Hi all, > I am an university student and these days i am on training period. So i > want to know about ruby on on rails "cucumber and Rspec". If somebody > know about these fields please help me. If not please send me an > tutorials for basic functionality of the cucumber and

Re: [rspec-users] Need Help

2009-09-21 Thread nruth
If you want a quick intro it's worth looking on http://www.slideshare.net/ for some intro talks at the many Rails conventions that have been held recently. Try searching for cucumber or rspec and see what falls out. There are videos of presentations out there too, for example http://www.engineyard

Re: [rspec-users] Need Help

2009-09-21 Thread doug livesey
If you go to peepcode.com, they have some excellent resources on RSpec & Cucumber, and there is always The RSpec Book (from the pragmatic programmers).HTH, Doug. 2009/9/21 Mithun Perera > Hi all, > I am an university student and these days i am on training period. So i > want to know about ru

[rspec-users] Need Help

2009-09-20 Thread Mithun Perera
Hi all, I am an university student and these days i am on training period. So i want to know about ruby on on rails "cucumber and Rspec". If somebody know about these fields please help me. If not please send me an tutorials for basic functionality of the cucumber and Rspec. Thank you. regards, Mit

Re: [rspec-users] Need help using URL helpers in controller tests

2008-10-10 Thread David Chelimsky
On Fri, Oct 10, 2008 at 9:37 AM, Christopher Bailey <[EMAIL PROTECTED]> wrote: > I've moved on from this with a bit different approach. But, I also found > that the "get" (or whichever http method used) call expects the first > parameter to be an action, so passing in a string that is a path or UR

Re: [rspec-users] Need help using URL helpers in controller tests

2008-10-10 Thread Christopher Bailey
I've moved on from this with a bit different approach. But, I also found that the "get" (or whichever http method used) call expects the first parameter to be an action, so passing in a string that is a path or URL doesn't work for that. On Fri, Oct 10, 2008 at 1:04 AM, Matt Wynne <[EMAIL PROTECT

Re: [rspec-users] Need help using URL helpers in controller tests

2008-10-10 Thread Matt Wynne
On 9 Oct 2008, at 20:24, Christopher Bailey wrote: I have a controller test, where I want to do a GET on a page. Our URL's are complex, and need to be correct (duh, but we allow some slop, but that causes a redirect which I want to avoid). Anyway, in my controller test I do a get to the

[rspec-users] Need help using URL helpers in controller tests

2008-10-09 Thread Christopher Bailey
I have a controller test, where I want to do a GET on a page. Our URL's are complex, and need to be correct (duh, but we allow some slop, but that causes a redirect which I want to avoid). Anyway, in my controller test I do a get to the URL that is produced by a helper method which calls a named

[rspec-users] Need help testing a module behavior with RSpec

2008-07-14 Thread Sean Schofield
I have a resource_security.rb file that includes instance and class method definitions. At the end of the file I mix these into ActiveRecord::Base. ActiveRecord::Base.class_eval { include ResourceSecurity::InstanceMethods } ActiveRecord::Base.class_eval { extend ResourceSecurity::ClassMethods }

Re: [rspec-users] Need help mocking this out

2007-12-16 Thread Pat Maddox
On Dec 16, 2007 1:43 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > I tend to take this one more step. I'm a bit of a demeter zealot, and > I'm also usually writing the examples from the code first. So I'd do > something like: > > it "should find the current users articles" do > article = mock_

Re: [rspec-users] Need help mocking this out

2007-12-16 Thread David Chelimsky
On Dec 16, 2007 4:01 PM, Daniel N <[EMAIL PROTECTED]> wrote: > > > > On Dec 17, 2007 8:43 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > > > On Dec 16, 2007 11:03 AM, Jonathan Linowes <[EMAIL PROTECTED]> > wrote: > > > > > > btw, to answer the same question for member actions (such as show), yo

Re: [rspec-users] Need help mocking this out

2007-12-16 Thread Daniel N
On Dec 17, 2007 8:43 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Dec 16, 2007 11:03 AM, Jonathan Linowes <[EMAIL PROTECTED]> > wrote: > > > > btw, to answer the same question for member actions (such as show), you > can > > stub or assert the association proxy class > > > > @article = cur

Re: [rspec-users] Need help mocking this out

2007-12-16 Thread David Chelimsky
On Dec 16, 2007 11:03 AM, Jonathan Linowes <[EMAIL PROTECTED]> wrote: > > btw, to answer the same question for member actions (such as show), you can > stub or assert the association proxy class > > @article = current_user.articles.find(params[:id]) > > then, > > it "should find article scoped by

Re: [rspec-users] Need help mocking this out

2007-12-16 Thread Jonathan Linowes
btw, to answer the same question for member actions (such as show), you can stub or assert the association proxy class @article = current_user.articles.find(params[:id]) then, it "should find article scoped by current_user" do article = mock_model(Article) current_user

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Jarkko Laine
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:

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread David Chelimsky
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Stefan Magnus Landrø
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Daniel Tenner
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Daniel N
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Jarkko Laine
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. > >

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Stefan Magnus Landrø
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.

[rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

[rspec-users] Need help mocking this out

2007-12-03 Thread Fischer, Daniel
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

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread David Chelimsky
On 9/13/07, Shaker <[EMAIL PROTECTED]> wrote: > > Sorry, that's another spec caused the error. It is working. Thank you very > much Glad you got it worked out. Cheers, David > > Shaker wrote: > > > > Hello > > To spec the example I mentioned before, I wrote the spec as what you > > suggested >

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Sorry, that's another spec caused the error. It is working. Thank you very much Shaker wrote: > > Hello > To spec the example I mentioned before, I wrote the spec as what you > suggested > #../view/group/index_spec.rb > describe "/group/_index_spec" do > it "should call JS function when

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Hello To spec the example I mentioned before, I wrote the spec as what you suggested #../view/group/index_spec.rb describe "/group/_index_spec" do it "should call JS function when click the button" do render '/group/_index' response.should have_tag("input[onclick=?]", "update()

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread David Chelimsky
On 9/13/07, Shaker <[EMAIL PROTECTED]> wrote: > > Yes, I have gone through the documentation before, and I read the reference > of 'assert_select' as well. But I still can not figure out a way of testing > attributes in a tag. What I know is we can use: > should have_tag("tag#id") or should have_

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Yes, I have gone through the documentation before, and I read the reference of 'assert_select' as well. But I still can not figure out a way of testing attributes in a tag. What I know is we can use: should have_tag("tag#id") or should have_tag("tag.class") to select a tag, whereas I don't know

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread David Chelimsky
On 9/13/07, Shaker <[EMAIL PROTECTED]> wrote: > I can not find much > information about the "should have_tag" syntax in Rspec. http://rspec.rubyforge.org/rdoc-rails/classes/Spec/Rails/Matchers.html#M11 ___ rspec-users mailing list rspec-users@rubyfor

[rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Hello everyone: I am kind of puzzled in writing spec on view partials. I can not find much information about the "should have_tag" syntax in Rspec. Can rspec test a particular attribute of a tag (e.g. input tag)? Let me put an example here: #../view/group/_index I want to test the "on

Re: [rspec-users] need help getting a word right

2007-07-18 Thread Mikel Lindsaar
I like the it "should..." do end calls, specifiy as well makes sense. So what is the problem? I think we should take a look at what comments are for. Essentially the "should blah" text acts as a comment on the spec. One that is then picked up by RSpec and inserted to make our specifications mor

Re: [rspec-users] need help getting a word right

2007-07-18 Thread barsalou
Well in that specific case, please seems like a good choice please do @thing.should be_somthing end But If you had text in between then it wouldn't seem the same: please "whatever text" do @thing.should be_something end Quoting David Chelimsky <[EMAIL PROTECTED]>: > H

Re: [rspec-users] need help getting a word right

2007-07-18 Thread Robert Feldt
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

Re: [rspec-users] need help getting a word right

2007-07-18 Thread Kyle Hargraves
David Chelimsky wrote: > Consise? Yes. But I'm not psyched about 'specify' either. There IS a > perfect word for this situation. What is it? Suggestions? Personally, I disagree. For examples like that, I think 'specify' is a pretty ideal word. It reads exactly as I want it to. Depending on what

Re: [rspec-users] need help getting a word right

2007-07-18 Thread Daniel N
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

[rspec-users] need help getting a word right

2007-07-18 Thread David Chelimsky
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 But "it do" is driving me mad :( We need a better word. O