Re: [rspec-users] specifying a controller's layout

2008-10-18 Thread David Chelimsky
On Sat, Oct 18, 2008 at 2:44 AM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-10-17, at 17:16, David Chelimsky wrote: >> >> Cool. Don't forget the seldom used #head, though I don't know what to >> call it: when_heading_to? > > I looked through the docs at http://rspec.rubyforge.org/rspec/1.1.8

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Scott Taylor
On Oct 18, 2008, at 4:40 AM, Thomas Watson Steen wrote: Hi I'm using RSpec in with Ruby on Rails. I've made a helper module method that generates some HTML and would like to create a rspec test to validate this HTML. I can of cause use regex to validate it as a string, but would much rat

Re: [rspec-users] Cucumber "standard base" setup?

2008-10-18 Thread William Tozier
On Oct 18, 2008, at 2:45 AM, aslak hellesoy wrote: On Sat, Oct 18, 2008 at 2:34 AM, William Tozier <[EMAIL PROTECTED] > wrote: * I need a Rakefile... but with what exactly in it? Many of the examples are different, and at least a few fail to run on my box (but that's external dependencies).

[rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Thomas Watson Steen
Hi I'm using RSpec in with Ruby on Rails. I've made a helper module method that generates some HTML and would like to create a rspec test to validate this HTML. I can of cause use regex to validate it as a string, but would much rather validate it by traversing the DOM and checking that t

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Pat Maddox
Scott Taylor <[EMAIL PROTECTED]> writes: > On Oct 18, 2008, at 4:40 AM, Thomas Watson Steen wrote: > >> Hi >> >> I'm using RSpec in with Ruby on Rails. I've made a helper module >> method that generates some HTML and would like to create a rspec >> test to validate this HTML. I can of cause use re

Re: [rspec-users] RSpec vs Screw.Unit

2008-10-18 Thread Pat Maddox
Scott Taylor <[EMAIL PROTECTED]> writes: > As for #3, I'm > pretty sure that Ruby's method_missing allows one to raise an > exception easily. Not sure what a Javascript mocking framework would > do in this case. I'm not sure that I buy that this feature is very important. Both Javascript and Ru

Re: [rspec-users] Any good conferences this year about ruby/rspec/watir?

2008-10-18 Thread Pat Maddox
juuuser <[EMAIL PROTECTED]> writes: > Hello. > > Sorry for this little offtopic question, but I was wondering if anyone > happens to know if there's any good conferences coming up about rspec or > ruby or watir in this year where I could attend to? > > Or any good website where such things are lis

Re: [rspec-users] RSpec vs Screw.Unit

2008-10-18 Thread Stephen Eley
On Sat, Oct 18, 2008 at 12:53 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > In Javascript, it might look more or less like this: > > var old_method = obj[my_method]; > my_obj[my_method] = my_return_value; That's an interesting syntax comparison, thanks, but not really what I was reacting to. Th

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Nick Hoffman
On 2008-10-18, at 09:16, Pat Maddox wrote: Scott Taylor <[EMAIL PROTECTED]> writes: You'd be able to write a spec like the following: it "should link with the correct name" do helper.should_receive(:link_to).with("foo", {:controller => "foo", :action => "foo"}) helper.my_method("foo") end

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Mark Wilden
On Sat, Oct 18, 2008 at 6:16 AM, Pat Maddox <[EMAIL PROTECTED]> wrote: > Does have_tag work with plain strings > Yep, it does. That's how I spec #to_amcharts. :) ///ark ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailma

[rspec-users] Problems when programmatically defining examples

2008-10-18 Thread Jake Benilov
Hi, I am trying to code an application that is based on Rspec; I am programmatically building examples, and launching the runner with a custom formatter. Here are the code snippets from my app: Launching the runner: example_groups = test_expectation.example_groups_for(system_stat

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 11:34 AM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-10-18, at 09:16, Pat Maddox wrote: >> >> Scott Taylor <[EMAIL PROTECTED]> writes: >>> >>> You'd be able to write a spec like the following: >>> >>> it "should link with the correct name" do >>> helper.should_receiv

Re: [rspec-users] Problems when programmatically defining examples

2008-10-18 Thread David Chelimsky
On Sat, Oct 18, 2008 at 2:13 PM, Jake Benilov <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to code an application that is based on Rspec; I am > programmatically building examples, and launching the runner with a custom > formatter. Here are the code snippets from my app: > > Launching the runn

[rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Zach Dennis
Writing feature inputs in the tabular format has recently been very helpful. However, there are some things that seem kind of funny when writing. For example, let's say we wanted to ensure that certain requests resulted in the access denied page: Given Joe is a staff member without the 'admin' p

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Ben Mabey
Zach Dennis wrote: Writing feature inputs in the tabular format has recently been very helpful. However, there are some things that seem kind of funny when writing. For example, let's say we wanted to ensure that certain requests resulted in the access denied page: Given Joe is a staff member

Re: [rspec-users] Where are those tables listed for fixtures?

2008-10-18 Thread Rasmus Rasmussen
Stephen Eley wrote: > On Fri, Oct 17, 2008 at 3:28 PM, Rasmus Rasmussen <[EMAIL PROTECTED]> > wrote: >> >> this feels like a duplication. If I write rspec-tests I should not do >> ordinary tests, because then I need to maintain two fixtures. Right? > > Correct. You don't need it. But the standa

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Scott Taylor
On Oct 18, 2008, at 9:16 AM, Pat Maddox wrote: Scott Taylor <[EMAIL PROTECTED]> writes: On Oct 18, 2008, at 4:40 AM, Thomas Watson Steen wrote: Hi I'm using RSpec in with Ruby on Rails. I've made a helper module method that generates some HTML and would like to create a rspec test to valid

[rspec-users] Error loading Rails fixtures

2008-10-18 Thread Scott Burton
Hi all; I'm getting a weird error from the rspec gem when using rake to load fixtures in rails: % rake db:fixtures:load RAILS_ENV=test /path/to/Ruby/Gems/1.8/gems/rspec-1.1.8/lib/spec/runner/options.rb: 229:in `files_to_load': File or directory not found: db:fixtures:load (RuntimeError) f

Re: [rspec-users] RSpec vs Screw.Unit

2008-10-18 Thread Scott Taylor
On Oct 18, 2008, at 9:19 AM, Pat Maddox wrote: Scott Taylor <[EMAIL PROTECTED]> writes: As for #3, I'm pretty sure that Ruby's method_missing allows one to raise an exception easily. Not sure what a Javascript mocking framework would do in this case. I'm not sure that I buy that this featu

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Stephen Eley
On Sat, Oct 18, 2008 at 2:13 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: > > Given Joe is a staff member without the '$privilege$' privilege > When I $request$ $path$ as Joe > Then I am notified that access was denied My only beef with this is that it breaks the pattern of writing scenarios in p

[rspec-users] Running Cucumber with a Rails Rake task

2008-10-18 Thread Ben Emson
Hi All I've just started experimenting with Cucumber and its great. However I wasn't quite sure how I should integrate it into my Rails application. What I would like to do is set my Rails app up so that I can run a Cucumber rake task using the standard Rails Rake system. I've looked through the

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 4:25 PM, Stephen Eley <[EMAIL PROTECTED]> wrote: > On Sat, Oct 18, 2008 at 2:13 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: >> >> Given Joe is a staff member without the '$privilege$' privilege >> When I $request$ $path$ as Joe >> Then I am notified that access was denied

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread aslak hellesoy
On Sat, Oct 18, 2008 at 10:25 PM, Stephen Eley <[EMAIL PROTECTED]> wrote: > On Sat, Oct 18, 2008 at 2:13 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: >> >> Given Joe is a staff member without the '$privilege$' privilege >> When I $request$ $path$ as Joe >> Then I am notified that access was denied

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Ashley Moran
On Oct 18, 2008, at 9:51 pm, Zach Dennis wrote: Given I login as Joe without the 'admin' privilege When I GET /admin Then I am notified that access was denied More Examples: | name | privilege | request_method | path| name | | Joe | admin | POST | /invoices | Joe | |

[rspec-users] Why @controller is nil error on loading fixtures in model?

2008-10-18 Thread Harry Bishop
Hi, I'm new to rspec and working on catching up my app with rspec testing. I'm running OSX 10.5.5 with Rails 2.1.0 and Rspec 1.1.8. Most things I've tried work except loading fixtures. I setup a describe block for the model as require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

Re: [rspec-users] Running Cucumber with a Rails Rake task

2008-10-18 Thread aslak hellesoy
On Sat, Oct 18, 2008 at 10:33 PM, Ben Emson <[EMAIL PROTECTED]> wrote: > Hi All > > I've just started experimenting with Cucumber and its great. > However I wasn't quite sure how I should integrate it into my Rails > application. > Have you read this? http://github.com/aslakhellesoy/cucumber/wikis

Re: [rspec-users] Problems when programmatically defining examples

2008-10-18 Thread Jake Benilov
David, Thanks for your reply; however I probably wasn't very clear in my explanation. What I am really trying to do is to create a builder for example group objects, without automatically adding the example groups to the rspec runner when the builder code is invoked. As an example, when I call th

Re: [rspec-users] Problems when programmatically defining examples

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 6:34 PM, Jake Benilov <[EMAIL PROTECTED]> wrote: > David, > > Thanks for your reply; however I probably wasn't very clear in my > explanation. What I am really trying to do is to create a builder for > example group objects, without automatically adding the example groups to

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Stephen Eley wrote: On Fri, Oct 17, 2008 at 2:55 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: and then check that the expected messages are being received - file.should_receive(:puts).with("a string").once file.should_receive(:puts).with("another string").once Here's what I'm puzzled about. I

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Stephen Eley
On Sat, Oct 18, 2008 at 9:49 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: > > [...] What I've observed is that it behaves differently > if I include a "should_not_receive('...')" expectation somewhere in the > spec. In that case it seems that I can have as many "file.puts()" in the > component bein

Re: [rspec-users] Test HTML output from Rails helper

2008-10-18 Thread Ashley Moran
On Oct 18, 2008, at 10:50 am, Scott Taylor wrote: No - that's not really an option. The rails stack has no idea about a DOM. One option, though, is to stub methods and use message expectations. For instance, if you had a helper like the following: Hi Scott Another option would be Hpr

Re: [rspec-users] Mocks: expectations vs spying

2008-10-18 Thread Pat Maddox
Ben Mabey <[EMAIL PROTECTED]> writes: > Pat has been working on adding the spy pattern to rspec I quit once I found not_a_mock [1] which works nicely. My preference would be to pull spies into RSpec eventually, but I want to use it a bit more first (and hopefully others will too). Pat [1] htt

Re: [rspec-users] Running Cucumber with a Rails Rake task

2008-10-18 Thread Zach Dennis
To run all features you can run: rake features To run specific features you can do something like: script/cucumber --require features/steps features/path/to/my.feature If you want to run a particular scenario find out the line number of the first Given and run: script/cucumber --line 41

Re: [rspec-users] RSpec vs Screw.Unit

2008-10-18 Thread Scott Taylor
On Oct 18, 2008, at 10:30 AM, Stephen Eley wrote: On Sat, Oct 18, 2008 at 12:53 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: In Javascript, it might look more or less like this: var old_method = obj[my_method]; my_obj[my_method] = my_return_value; That's an interesting syntax comparison, th

Re: [rspec-users] Why @controller is nil error on loading fixtures in model?

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 6:10 PM, Harry Bishop <[EMAIL PROTECTED]> wrote: > Hi, > I'm new to rspec and working on catching up my app with rspec testing. > I'm running OSX 10.5.5 with Rails 2.1.0 and Rspec 1.1.8. > Most things I've tried work except loading fixtures. I setup a describe > block for

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Zach Dennis
I'm top posting... I wish I could inline post, but you provided a lot of generalizations for how you think things are working on your code, but you don't actually post concrete code (the should_receive and should_not_receive case you mentioned that wasn't acting like you'd expect). Perhaps this wil

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 5:42 PM, Ashley Moran <[EMAIL PROTECTED]> wrote: > > On Oct 18, 2008, at 9:51 pm, Zach Dennis wrote: > >> Given I login as Joe without the 'admin' privilege >> When I GET /admin >> Then I am notified that access was denied >> >> More Examples: >> | name | privilege | request

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Stephen Eley
(I just realized that Zach was doing some sort of reply-all that included my address separately, and had my reply going to him instead of the list. So I'm sending it to the list now as I originally intended.) On Sat, Oct 18, 2008 at 4:51 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: > > I don't kno

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Zach Dennis
On Sat, Oct 18, 2008 at 7:37 PM, Stephen Eley <[EMAIL PROTECTED]> wrote: > On Sat, Oct 18, 2008 at 4:51 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: >> >> I don't know if it damages the scenario as a whole. After all, the >> reason you're using tabular data in the first place is so you can >> re-use

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-18 Thread Joseph Wilk
Ben Mabey wrote: > > As far as your suggestion about using placeholders instead of a real > example set- I like it. This was actually brought up a little while ago > by Evan Light on this list so I think it is something that people > naturally move towards. As Ben said this has cropped up i

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Stephen Eley wrote: On Sat, Oct 18, 2008 at 9:49 PM, Mark Thomson <[EMAIL PROTECTED]> wrote: [...] What I've observed is that it behaves differently if I include a "should_not_receive('...')" expectation somewhere in the spec. In that case it seems that I can have as many "file.puts()" in th

Re: [rspec-users] Surprising mock behavior

2008-10-18 Thread Mark Thomson
Zach Dennis wrote: I'm top posting... I wish I could inline post, but you provided a lot of generalizations for how you think things are working on your code, but you don't actually post concrete code (the should_receive and should_not_receive case you mentioned that wasn't acting like you'd exp