Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread Nickolay Kolev
Thanks for the explanation, David! Makes sense now. Best, Nickolay ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] have_tag missing assert_select outside of controller/view tests

2010-02-17 Thread Ed Howland
Thanks, David. I hope that is less/non dependent on Rails/ActiveSupport. It seems to depend on Nokogiri, and hopefully uses some duck-typeable response object. I guess they use response_body. I've concocted a strange brew of RSpec, Johnson and envjs. It can already execute normal Javascript metho

Re: [rspec-users] have_tag missing assert_select outside of controller/view tests

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 12:47 PM, Ed Howland wrote: > Hi, > > I'm trying to write an example that uses response.should have_tag('div') > outside of a Rails view test. I read somewhere that as long as you > have an instance variable named @response and it respondes to .body > with some HTML, it sho

[rspec-users] have_tag missing assert_select outside of controller/view tests

2010-02-17 Thread Ed Howland
Hi, I'm trying to write an example that uses response.should have_tag('div') outside of a Rails view test. I read somewhere that as long as you have an instance variable named @response and it respondes to .body with some HTML, it should work, but I get this failure: undefined method `assert_sele

Re: [rspec-users] Trying to write a failing test-- but am failing!

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 12:24 PM, patrick99e99 wrote: >> That's likely because cucumber is generating a rerun.txt file and >> autotest is picking that up for some reason. > > Ah..  I do see that in my project directory there is a rerun.txt > file...  How did that get created, and is the solution j

Re: [rspec-users] Trying to write a failing test-- but am failing!

2010-02-17 Thread patrick99e99
> That's likely because cucumber is generating a rerun.txt file and > autotest is picking that up for some reason. Ah.. I do see that in my project directory there is a rerun.txt file... How did that get created, and is the solution just to delete it? -patrick __

Re: [rspec-users] Trying to write a failing test-- but am failing!

2010-02-17 Thread Andrei Erdoss
I also get the infinite looping of the cucumber features being run. The way I stopped it is by adding this: Autotest.add_hook :initialize do |at| %w{.svn .hg .git vendor rerun.txt}.each {|exception| at.add_exception(exception) } end to ~/.autotest Is there a better to do this? On Wed,

Re: [rspec-users] running rspec complains about missing cucumber-rails

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 9:07 AM, kat...@gmail.com wrote: > I think I have solved this. > > I was using config.gem for cucumber and cucumber-rails. Setting :lib > => false solves this problem. > > Would you consider specifying this on > http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails?

Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 8:31 AM, Nickolay Kolev wrote: >> This is not working for the reason that I think you think it's >> working. and_return is not an expectation - it is a command telling >> @teacher to return @new_course when it receives :build. You have to >> define @new_course in the spec.

Re: [rspec-users] running rspec complains about missing cucumber-rails

2010-02-17 Thread kat...@gmail.com
I think I have solved this. I was using config.gem for cucumber and cucumber-rails. Setting :lib => false solves this problem. Would you consider specifying this on http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails? Kaushik On Feb 16, 9:03 am, "kat...@gmail.com" wrote: > Hello, > I

Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread Nickolay Kolev
> This is not working for the reason that I think you think it's > working. and_return is not an expectation - it is a command telling > @teacher to return @new_course when it receives :build. You have to > define @new_course in the spec. I did the following: http://gist.github.com/306521 and it

Re: [rspec-users] Trying to write a failing test-- but am failing!

2010-02-17 Thread David Chelimsky
On Tue, Feb 16, 2010 at 10:24 PM, patrick99e99 wrote: >> What command are you running? > > I have just been doing script/autospec > > ..  I actually posted on the rspecbook forum (haven't heard anything > yet, so I'll ask here) regarding autospec..  When I ran it, it told me > that features were b

Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 8:03 AM, Nickolay Kolev wrote: >> I don't see @new_course getting defined anywhere. Try assigning it a >> non-nil value in each of the POST examples (or in before(:each) in >> that group). > > Thanks, David! > > Am I right in assuming that I have to check that @new_course r

Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread Nickolay Kolev
> I don't see @new_course getting defined anywhere. Try assigning it a > non-nil value in each of the POST examples (or in before(:each) in > that group). Thanks, David! Am I right in assuming that I have to check that @new_course received a "save" and returned true in the same it-block? This wo

Re: [rspec-users] hash_include with regular expression

2010-02-17 Thread David Chelimsky
On Tue, Feb 16, 2010 at 7:09 AM, mikev wrote: > > I'm trying to match a string in a hash passed to :find using a regular > expression since I don't want to know all the other details of > the :conditions passed to find.  I've tried variations on the > following with no success, e.g., not using has

Re: [rspec-users] adding to the callbacks that rspec-rails adds

2010-02-17 Thread David Chelimsky
On Tue, Feb 16, 2010 at 10:48 AM, Ben Fyvie wrote: > I have some code that adds to the callbacks that rspec-rails adds by default > to href="http://github.com/dchelimsky/rspec-rails/blob/master/lib/spec/rails/interop/testcase.rb";>setup > and teardown fixtures. > > > > My code looks something lik

Re: [rspec-users] Stubbing @instance.association.build

2010-02-17 Thread David Chelimsky
On Wed, Feb 17, 2010 at 5:44 AM, Nickolay Kolev wrote: > Hi all, > > I am trying to spec a controller for a nested resource: > > http://gist.github.com/306521 > > Running the spec as it is in the gist results in > > undefined method `save' for nil:NilClass (line 66 in the gist) > > So should_recei

[rspec-users] Stubbing @instance.association.build

2010-02-17 Thread Nickolay Kolev
Hi all, I am trying to spec a controller for a nested resource: http://gist.github.com/306521 Running the spec as it is in the gist results in undefined method `save' for nil:NilClass (line 66 in the gist) So should_receive is interfering with the build message resulting in @course ending up n