Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-23 Thread Steve
On Tue, 23 Oct 2007 17:58:45 -0500, David Chelimsky wrote: I don't know if there are any repercussions, but just adding :text to the array in rspec_on_rails/lib/spec/rails/dsl/behaviour/view_example.rb:subject_of_render was enough to make it work. That's cool, but that's not how we do

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-22 Thread David Chelimsky
On 10/22/07, David Chelimsky [EMAIL PROTECTED] wrote: Actually, it turns out that you can do this in a view spec: render /path/to/my/file.html.erb, :layout = application and it will render with the layout. So you *could* (in theory, I haven't done this yet) do something like this: Actually

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-22 Thread Jay Levitt
On 10/22/2007 5:25 AM, David Chelimsky wrote: $yielded = false ::Cough:: I believe the past tense is yelt. Jay ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-22 Thread Steve
On Mon, 22 Oct 2007 04:49:50 -0500, David Chelimsky wrote: On 10/22/07, David Chelimsky [EMAIL PROTECTED] wrote: Actually, it turns out that you can do this in a view spec: render /path/to/my/file.html.erb, :layout = application and it will render with the layout. So you *could* (in

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-22 Thread David Chelimsky
On 10/22/07, Steve [EMAIL PROTECTED] wrote: On Mon, 22 Oct 2007 04:49:50 -0500, David Chelimsky wrote: On 10/22/07, David Chelimsky [EMAIL PROTECTED] wrote: Actually, it turns out that you can do this in a view spec: render /path/to/my/file.html.erb, :layout = application and it will

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-22 Thread Steve
On Mon, 22 Oct 2007 20:06:50 -0500, David Chelimsky wrote: It would feel even less hackish if render supported :text like rails render does. So you could do this: render :text = 'divyielded/div', :layout = 'application' response.should have_tag('div', 'yielded') Good idea. Feature request

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-21 Thread Steve
On Tue, 09 Oct 2007 21:12:09 +0100, Matt Patterson wrote: It occured to me that it would be nice to have a spec that would barf if I ever nuked the layout's yield (or, indeed, one of its content_for yields), mainly because they're the integration point between layouts and views, and

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-09 Thread Lance Carlson
I'm not sure you want to test that the yield call works, but merely that it is being called because you will end up creating an integration test otherwise. I would suggest just stubbing out the yield call. I'm pretty sure you can just do template.stub!(:yield) ? On 10/9/07, Matt Patterson [EMAIL

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-09 Thread Lance Carlson
Also maybe instead of and_return.. you would do and_yield('') On 10/9/07, Lance Carlson [EMAIL PROTECTED] wrote: It is a ruby keyword, but isn't also just a method being called in the view? On 10/9/07, Jean-François Trân [EMAIL PROTECTED] wrote: 2007/10/9, Lance Carlson [EMAIL PROTECTED]:

Re: [rspec-users] Testing layouts with RSpec on Rails

2007-10-09 Thread Matt Patterson
On 9 Oct 2007, at 19:55, Jean-François Trân wrote: 2007/10/9, Lance Carlson [EMAIL PROTECTED]: or if you want to test that it is being called.. you could do template.should_receive(:yield).and_return('') I'm missing a point... how can you expect to receive a :yield message since yield is a