From thenewjhp at gmail.com Mon Sep 4 04:47:11 2006 From: thenewjhp at gmail.com (Jason Anderson) Date: Mon, 4 Sep 2006 01:47:11 -0700 Subject: [Rspec-users] RSpec style in Scriptaculous' unittest.js In-Reply-To: <8d961d900608310300x4af50af6pfceec46fb29b034b@mail.gmail.com> References: <8d961d900608310300x4af50af6pfceec46fb29b034b@mail.gmail.com> Message-ID: All, I can't help noticing a bit of code that I keep repeating. I find myself writing things like: specify "should be empty" do @stack.should_be_empty end Instead, suppose rspec captured and stored the result of setup() and used that value automatically if specify() is called without a block? Here's how it might look, using the example from the rspec page: context "BDD framework" do setup do BddFramework.new # value stored by rspec end specify "should be adopted quickly" specify "should be intuitive" end Lovely, no? Best, Jason Anderson thenewjhp at gmail.com From aslak.hellesoy at gmail.com Mon Sep 4 10:34:13 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Mon, 4 Sep 2006 16:34:13 +0200 Subject: [Rspec-users] RSpec style in Scriptaculous' unittest.js In-Reply-To: References: <8d961d900608310300x4af50af6pfceec46fb29b034b@mail.gmail.com> Message-ID: <8d961d900609040734y62980bf4h76f2ee6a28b327cf@mail.gmail.com> On 9/4/06, Jason Anderson wrote: > All, > > I can't help noticing a bit of code that I keep repeating. > When starting a new topic, please don't reply to an existing mail. > I find myself writing things like: > > specify "should be empty" do > @stack.should_be_empty > end > > Instead, suppose rspec captured and stored the result of setup() and > used that value automatically if specify() is called without a block? > Here's how it might look, using the example from the rspec page: > > context "BDD framework" do > > setup do > BddFramework.new # value stored by rspec > end > > specify "should be adopted quickly" > specify "should be intuitive" > > end > > Lovely, no? > Interesting approach to getting rid of duplication! Please submit a feature request at Rubyforge. Or better - a patch. Aslak > > Best, > > Jason Anderson > thenewjhp at gmail.com > _______________________________________________ > Rspec-users mailing list > Rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From dchelimsky at gmail.com Tue Sep 5 09:05:31 2006 From: dchelimsky at gmail.com (David Chelimsky) Date: Tue, 5 Sep 2006 08:05:31 -0500 Subject: [Rspec-users] volunteers to prove out experiment Message-ID: <57c63afe0609050605p1a727577ma42e02db25ebe327@mail.gmail.com> All, I've created a branch with the modules and directories restructured to reflect three distinct modules: Spec::Expectations Spec::Mocks Spec::Runner Will the brave among you (with a little time on your hands - just a little) please check out the branch, build and install the gem and let me know if you run into any problems? svn co svn://rubyforge.org/var/svn/rspec/branches/modularized cd modularized rake gem gem install pkg/rspec-0.6.4.gem I'd like to merge this to the trunk as soon as possible to minimize the merge pain, but I want to make sure I'm not missing anything glariing. Thanks, David From aslak.hellesoy at gmail.com Wed Sep 6 10:06:07 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 6 Sep 2006 16:06:07 +0200 Subject: [Rspec-users] RSpec and Watir Message-ID: <8d961d900609060706h29ab680egd908a18321dffbe2@mail.gmail.com> Hi all, (Sorry for cross-posting - please reply to only one list, preferrably wtr-general) I just started on a project where it looks like we might start using Watir. I just whipped up a little example and some doco about how to (and why) use RSpec with Watir. It's in RSpec's subversion under trunk/vendor/watir http://rubyforge.org/scm/?group_id=797 http://rubyforge.org/plugins/scmsvn/viewcvs.php/trunk/vendor/watir/?root=rspec There is a README where I try explain some of the benefits of the RSpec/Watir combo - from a user/qa/tester perspective. RSpec's specdoc feature, documentation and communication is key here. Please take a look and give some feedback. I'd like to put this up on RSpec's web page soon. Aslak From dchelimsky at gmail.com Wed Sep 6 10:52:55 2006 From: dchelimsky at gmail.com (David Chelimsky) Date: Wed, 6 Sep 2006 09:52:55 -0500 Subject: [Rspec-users] support for arbitrary comparisons Message-ID: <57c63afe0609060752q1e18edf9pd16ddf518a2f2191@mail.gmail.com> Mike Williams contributed a patch to support arbitrary comparisons. This is now in the trunk and will be part of the next release. So you will now be able to do this: result.should_be < 5 result.should_be >= 7 It also supports alternate syntax for should_be, should_match result.should == 3 result.should =~ /regex/ Personally, I prefer should_be and should_match in these cases, as I think they read better. Anyone else have opinions about that? This patch also supports using methods that are not formatted like predicates but act like them: def whatever true end subject.should_be_whatever I really object to this on philosophical grounds. Ruby predicates are a beautiful construct, and I personally feel that if you're writing methods like that you are violating a ruby aesthetic. If you agree with that, then you have to agree that supporting them in rspec also violates the same aesthetic. To that end, even though they work, they will not be offically supported at this point (i.e. you can use them, but they may go away some day). I'm curious to hear thoughts on this as well. Thanks again to Mike Williams for supporting arbitrary comparisons. It's really a great addition. Cheers, David From aslak.hellesoy at gmail.com Wed Sep 6 11:47:16 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 6 Sep 2006 17:47:16 +0200 Subject: [Rspec-users] [Rspec-devel] support for arbitrary comparisons In-Reply-To: <57c63afe0609060752q1e18edf9pd16ddf518a2f2191@mail.gmail.com> References: <57c63afe0609060752q1e18edf9pd16ddf518a2f2191@mail.gmail.com> Message-ID: <8d961d900609060847p53a9ac03n2053c9745771bbca@mail.gmail.com> On 9/6/06, David Chelimsky wrote: > Mike Williams contributed a patch to support arbitrary comparisons. > This is now in the trunk and will be part of the next release. So you > will now be able to do this: > > result.should_be < 5 > result.should_be >= 7 > > It also supports alternate syntax for should_be, should_match > > result.should == 3 > result.should =~ /regex/ > > Personally, I prefer should_be and should_match in these cases, as I > think they read better. Anyone else have opinions about that? > I prefer should_match and should_equal too, but I don't expect everyone to feel the same. I think it's great to support both. I don't see a problem with making this official now and add it to the website documentation. Dave's cheatsheet (which is not in svn - grr) should be updated too. > This patch also supports using methods that are not formatted like > predicates but act like them: > > def whatever > true > end > > subject.should_be_whatever > > I really object to this on philosophical grounds. Ruby predicates are > a beautiful construct, and I personally feel that if you're writing > methods like that you are violating a ruby aesthetic. If you agree > with that, then you have to agree that supporting them in rspec also > violates the same aesthetic. To that end, even though they work, they > will not be offically supported at this point (i.e. you can use them, > but they may go away some day). > I agree we shouldn't support non-questionmark "predicates". Let's make the day support for it goes away be today ;-) > I'm curious to hear thoughts on this as well. > > Thanks again to Mike Williams for supporting arbitrary comparisons. > It's really a great addition. > > Cheers, > David > _______________________________________________ > Rspec-devel mailing list > Rspec-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-devel > From geeksam at gmail.com Wed Sep 6 13:53:19 2006 From: geeksam at gmail.com (Sam Livingston-Gray) Date: Wed, 6 Sep 2006 10:53:19 -0700 Subject: [Rspec-users] DRb error when using rails_spec on OS X Message-ID: <7beb6b8c0609061053g4d117734kae81859c8cc50e59@mail.gmail.com> Hi, all- I started playing with RSpec in a new Rails app. I've installed the plugin and bootstrapped it, and run 'script/rails_spec_runner' (not rails_spec_server as the website currently reads, btw) in a separate shell, then in another shell I run 'script/rails_spec' and get the following: /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo': getaddrinfo: No address associated with nodename (SocketError) from /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `open_server_inaddr_any' from /usr/local/lib/ruby/1.8/drb/drb.rb:860:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:756:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:754:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:1336:in `initialize' from /usr/local/lib/ruby/1.8/drb/drb.rb:1624:in `start_service' from script/rails_spec:6 Running 'rake spec:models' does work, though with the same overhead of 'rake test:units'. I'm on Mac OS 10.4.7 running ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0] and RSpec 0.6.3. The firewall on this machine is active, but I've opened port 8989 for both TCP and UDP (you know, just in case) with no change in behavior. Any help would be appreciated. Thanks, -Sam From aslak.hellesoy at gmail.com Wed Sep 6 15:12:46 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 6 Sep 2006 21:12:46 +0200 Subject: [Rspec-users] DRb error when using rails_spec on OS X In-Reply-To: <7beb6b8c0609061053g4d117734kae81859c8cc50e59@mail.gmail.com> References: <7beb6b8c0609061053g4d117734kae81859c8cc50e59@mail.gmail.com> Message-ID: <8d961d900609061212m4e6fe5bctfa435b3b75079d79@mail.gmail.com> On 9/6/06, Sam Livingston-Gray wrote: > Hi, all- > > I started playing with RSpec in a new Rails app. I've installed the > plugin and bootstrapped it, and run 'script/rails_spec_runner' (not > rails_spec_server as the website currently reads, btw) I've fixed this on trunk. The file will from now on be called script/rails_spec_server as the docs say. > in a separate > shell, then in another shell I run 'script/rails_spec' and get the > following: > That should give you the same as if you run just 'spec' (the standard rspec help). What you should do is 'script/rails_spec spec' although your problem seems to be related to something else. > /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo': getaddrinfo: > No address associated with nodename (SocketError) > from /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `open_server_inaddr_any' > from /usr/local/lib/ruby/1.8/drb/drb.rb:860:in `open_server' > from /usr/local/lib/ruby/1.8/drb/drb.rb:756:in `open_server' > from /usr/local/lib/ruby/1.8/drb/drb.rb:754:in `open_server' > from /usr/local/lib/ruby/1.8/drb/drb.rb:1336:in `initialize' > from /usr/local/lib/ruby/1.8/drb/drb.rb:1624:in `start_service' > from script/rails_spec:6 > > Running 'rake spec:models' does work, though with the same overhead of > 'rake test:units'. > > I'm on Mac OS 10.4.7 running ruby 1.8.4 (2005-12-24) > [powerpc-darwin8.4.0] and RSpec 0.6.3. The firewall on this machine Weird. I can't reproduce this. I have the same versions of everything as you. It's probably a drb issue. > is active, but I've opened port 8989 for both TCP and UDP (you know, > just in case) with no change in behavior. > > Any help would be appreciated. > Let's determine whether it's a pure Drb problem. Can you get this example to work? => http://www.rubycentral.com/book/ospace.html#UG If that doesn't work your problem is outside rspec. Let me know how it goes and I'll dig further. Aslak > Thanks, > -Sam > _______________________________________________ > Rspec-users mailing list > Rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From aslak.hellesoy at gmail.com Wed Sep 6 15:34:31 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 6 Sep 2006 21:34:31 +0200 Subject: [Rspec-users] DRb error when using rails_spec on OS X In-Reply-To: <8d961d900609061212m4e6fe5bctfa435b3b75079d79@mail.gmail.com> References: <7beb6b8c0609061053g4d117734kae81859c8cc50e59@mail.gmail.com> <8d961d900609061212m4e6fe5bctfa435b3b75079d79@mail.gmail.com> Message-ID: <8d961d900609061234o6abc9345gbce16f1d44276ebf@mail.gmail.com> On 9/6/06, aslak hellesoy wrote: > On 9/6/06, Sam Livingston-Gray wrote: > > Hi, all- > > > > I started playing with RSpec in a new Rails app. I've installed the > > plugin and bootstrapped it, and run 'script/rails_spec_runner' (not > > rails_spec_server as the website currently reads, btw) > > I've fixed this on trunk. The file will from now on be called > script/rails_spec_server as the docs say. > > > in a separate > > shell, then in another shell I run 'script/rails_spec' and get the > > following: > > > > That should give you the same as if you run just 'spec' (the standard > rspec help). What you should do is 'script/rails_spec spec' although > your problem seems to be related to something else. > > > /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo': getaddrinfo: > > No address associated with nodename (SocketError) > > from /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `open_server_inaddr_any' > > from /usr/local/lib/ruby/1.8/drb/drb.rb:860:in `open_server' > > from /usr/local/lib/ruby/1.8/drb/drb.rb:756:in `open_server' > > from /usr/local/lib/ruby/1.8/drb/drb.rb:754:in `open_server' > > from /usr/local/lib/ruby/1.8/drb/drb.rb:1336:in `initialize' > > from /usr/local/lib/ruby/1.8/drb/drb.rb:1624:in `start_service' > > from script/rails_spec:6 > > > > Running 'rake spec:models' does work, though with the same overhead of > > 'rake test:units'. > > > > I'm on Mac OS 10.4.7 running ruby 1.8.4 (2005-12-24) > > [powerpc-darwin8.4.0] and RSpec 0.6.3. The firewall on this machine > > > Weird. I can't reproduce this. I have the same versions of everything as you. > It's probably a drb issue. > > > is active, but I've opened port 8989 for both TCP and UDP (you know, > > just in case) with no change in behavior. > > > > Any help would be appreciated. > > > > Let's determine whether it's a pure Drb problem. Can you get this > example to work? > => http://www.rubycentral.com/book/ospace.html#UG > > If that doesn't work your problem is outside rspec. Let me know how it > goes and I'll dig further. > Try these: a) Replace 'druby://localhost:8989' with 'druby://localhost:0' in both rails_spec and rails_spec_runner b) Replace 'druby://localhost:8989' with 'druby://localhost.localdomain:8989:' in both rails_spec and rails_spec_runner c) Replace 'druby://localhost:8989' with 'druby://127.0.0.1:8989:' in both rails_spec and rails_spec_runner Do any of these get you further? Aslak > Aslak > > > Thanks, > > -Sam > > _______________________________________________ > > Rspec-users mailing list > > Rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > From geeksam at gmail.com Thu Sep 7 00:44:29 2006 From: geeksam at gmail.com (Sam Livingston-Gray) Date: Wed, 6 Sep 2006 21:44:29 -0700 Subject: [Rspec-users] DRb error when using rails_spec on OS X In-Reply-To: <8d961d900609061234o6abc9345gbce16f1d44276ebf@mail.gmail.com> References: <7beb6b8c0609061053g4d117734kae81859c8cc50e59@mail.gmail.com> <8d961d900609061212m4e6fe5bctfa435b3b75079d79@mail.gmail.com> <8d961d900609061234o6abc9345gbce16f1d44276ebf@mail.gmail.com> Message-ID: <7beb6b8c0609062144t4a7c4ecbh56ffd00558145694@mail.gmail.com> > > Weird. I can't reproduce this. I have the same versions of everything as you. > > It's probably a drb issue. Looks like it, yes. > > Let's determine whether it's a pure Drb problem. Can you get this > > example to work? > > => http://www.rubycentral.com/book/ospace.html#UG > > > > If that doesn't work your problem is outside rspec. Let me know how it > > goes and I'll dig further. Nope, same issue (and therefore, officially Not Your Problem). (= > Try these: > > a) Replace 'druby://localhost:8989' with 'druby://localhost:0' in both > rails_spec and rails_spec_runner Same behavior... > b) Replace 'druby://localhost:8989' with > 'druby://localhost.localdomain:8989:' in both rails_spec and > rails_spec_runner Doing this, rails_spec_runner aborts with the following: Loading Rails environment Ready /usr/local/lib/ruby/1.8/drb/drb.rb:862:in `initialize': getaddrinfo: No address associated with nodename (SocketError) from /usr/local/lib/ruby/1.8/drb/drb.rb:862:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:756:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:754:in `open_server' from /usr/local/lib/ruby/1.8/drb/drb.rb:1336:in `initialize' from /usr/local/lib/ruby/1.8/drb/drb.rb:1624:in `start_service' from script/rails_spec_runner:47 > c) Replace 'druby://localhost:8989' with 'druby://127.0.0.1:8989:' in > both rails_spec and rails_spec_runner Same as (a), above. Thanks for the help, though. The spec runner will probably work on the Windows box where I've been doing most of my for-pay Rails dev anyway; this was certainly enough for me to get a flavor of using RSpect with Rails. (It's certainly no slower than the Test::Unit stuff... and as a bonus, it doesn't overload %w( unit functional integration ). (= -Sam From aslak.hellesoy at gmail.com Thu Sep 7 05:43:52 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Thu, 7 Sep 2006 11:43:52 +0200 Subject: [Rspec-users] Dead easy Watir AND Selenium Message-ID: <8d961d900609070243k5ac8e877p5333ced152e47874@mail.gmail.com> Yesterday I added some Watir examples to RSpec's svn. Today I added some Selenium (actually - Selenium Remote Control) examples. It's dead easy to use both, and the Ruby code you end up writing is actually quite similar. Here's a taste: == Watir == require File.dirname(__FILE__) + '/rspec_watir' context "Google's search page" do setup do @browser.goto('http://www.google.com') end specify "should find rspec's home page" do @browser.text_field(:name, "q").set("rspec") @browser.button(:name, "btnG").click @browser.contains_text("rspec.rubyforge.org").should_be(true) end specify "should not find Ali G when I search for rspec" do @browser.text_field(:name, "q").set("rspec") @browser.button(:name, "btnG").click @browser.contains_text("Ali G").should_be(false) end end == Selenium == require File.dirname(__FILE__) + '/rspec_selenium' context "Google's search page" do setup do @browser = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "http://www.google.no", 10000) @browser.start @browser.open('http://www.google.no') end specify "should find rspec's home page" do @browser.type "name=q", "rspec" @browser.click_and_wait "name=btnG" @browser.is_text_present("rspec.rubyforge.org").should_be(true) end specify "should not find Ali G when I search for rspec" do @browser.type "name=q", "rspec" @browser.click_and_wait "name=btnG" @browser.is_text_present("Ali G").should_be(false) end end From micah at 8thlight.com Wed Sep 13 02:50:46 2006 From: micah at 8thlight.com (Micah Martin) Date: Wed, 13 Sep 2006 01:50:46 -0500 Subject: [Rspec-users] stale spec runner? Message-ID: I've been working with the RSpec on Rails plugin. Great job guys! The Rails spec runner (server) definitely speeds things up nicely. But I'm having some trouble keeping it functional. When I start the server, the first spec execution runs fine. Every following execution fails though. Each spec complains about the 'controller_path' missing from my controller. Odd. This only seems to affect controller specs. I've tried a few things to no avail. Any tips? 1) NoMethodError in 'Guesser play start' undefined method `controller_path' for GuesserController:Class ./spec/controllers/guesser_spec.rb:18:in `play start' ./spec/controllers/guesser_spec.rb:17:in `play start' 2) NoMethodError in 'Guesser game gets created on new game' undefined method `controller_path' for GuesserController:Class ./spec/controllers/guesser_spec.rb:25:in `game gets created on new game' ./spec/controllers/guesser_spec.rb:23:in `game gets created on new game' 3) NoMethodError in 'Guesser game id in hidden input' undefined method `controller_path' for GuesserController:Class ./spec/controllers/guesser_spec.rb:32:in `game id in hidden input' ./spec/controllers/guesser_spec.rb:31:in `game id in hidden input' 4) NoMethodError in 'Guesser first guess gets saved' undefined method `controller_path' for GuesserController:Class ./spec/controllers/guesser_spec.rb:38:in `first guess gets saved' ./spec/controllers/guesser_spec.rb:37:in `first guess gets saved' Micah Martin 8th Light, Inc. www.8thlight.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20060913/8bfbd431/attachment-0001.html From srbaker at pobox.com Wed Sep 13 02:57:15 2006 From: srbaker at pobox.com (Steven R. Baker) Date: Tue, 12 Sep 2006 23:57:15 -0700 Subject: [Rspec-users] stale spec runner? In-Reply-To: References: Message-ID: <78056024-90AA-4EF9-AB3A-026A3ED32A01@pobox.com> > I've been working with the RSpec on Rails plugin. Great job guys! > > The Rails spec runner (server) definitely speeds things up nicely. > But I'm having some trouble keeping it functional. When I start > the server, the first spec execution runs fine. Every following > execution fails though. Each spec complains about the > 'controller_path' missing from my controller. Odd. This only > seems to affect controller specs. I've tried a few things to no > avail. Any tips? This is a pretty simple backtrace; syntax errors. Let's see the code that's generating these errors. -Steven From aslak.hellesoy at gmail.com Wed Sep 13 03:14:23 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 13 Sep 2006 09:14:23 +0200 Subject: [Rspec-users] stale spec runner? In-Reply-To: References: Message-ID: <8d961d900609130014v2278a458jbb6570c88f960264@mail.gmail.com> On 9/13/06, Micah Martin wrote: > I've been working with the RSpec on Rails plugin. Great job guys! > > The Rails spec runner (server) definitely speeds things up nicely. But I'm > having some trouble keeping it functional. When I start the server, the > first spec execution runs fine. Every following execution fails though. > Each spec complains about the 'controller_path' missing from my controller. > Odd. This only seems to affect controller specs. I've tried a few things > to no avail. Any tips? > > 1) > NoMethodError in 'Guesser play start' > undefined method `controller_path' for GuesserController:Class > ./spec/controllers/guesser_spec.rb:18:in `play start' > ./spec/controllers/guesser_spec.rb:17:in `play start' > > 2) > NoMethodError in 'Guesser game gets created on new game' > undefined method `controller_path' for GuesserController:Class > ./spec/controllers/guesser_spec.rb:25:in `game gets created > on new game' > ./spec/controllers/guesser_spec.rb:23:in `game gets created > on new game' > > 3) > NoMethodError in 'Guesser game id in hidden input' > undefined method `controller_path' for GuesserController:Class > ./spec/controllers/guesser_spec.rb:32:in `game id in hidden > input' > ./spec/controllers/guesser_spec.rb:31:in `game id in hidden > input' > > 4) > NoMethodError in 'Guesser first guess gets saved' > undefined method `controller_path' for GuesserController:Class > ./spec/controllers/guesser_spec.rb:38:in `first guess gets > saved' > ./spec/controllers/guesser_spec.rb:37:in `first guess gets > saved' > I think this might be fixed on trunk. Try this: sudo gem uninstall rspec Get the trunk from svn rake gem sudo gem install pkg/rspec....gem install rspec_on_rails from trunk instead of tagged version If this works, everything should be fine in the 0.6.4, which is right around the corner Aslak > > Micah Martin > 8th Light, Inc. > www.8thlight.com > > > _______________________________________________ > Rspec-users mailing list > Rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > From jerry.west at ntlworld.com Fri Sep 29 17:49:46 2006 From: jerry.west at ntlworld.com (Jerry West) Date: Fri, 29 Sep 2006 22:49:46 +0100 Subject: [Rspec-users] Living Dangerously? Message-ID: <451D94FA.8030804@ntlworld.com> how can I get the benefits of integration testing with Rspec on Rails REL_0_6_3, please? When I first started playing with Rspec on Rails, I hacked spec_helper.rb to include the IntegrationTest interface (diff below) as it was the minimum change I could make to get the the ability to run multiple actions across controllers in my spec. I use it to specify authenticated sessions and stuff. No, I didn't know what I was doing, but it seemed to work. Today it bit me. I most-always run my specs separately so I know what's failed but today I was doing some regression testing so ran rake spec:controllers for the first time (gasp!). Specs started to fail on the basic "controller.should_be_instance_of ...": should be an instance of A simple trace in lib/rspec_on_rails.rb (around lines 43-48) shows the following... >>>>>looking for AccountController >>>>>found # (next test) >>>>>looking for FeedbackController >>>>>found # >>>>>looking for FeedbackController >>>>>found # What really messes my brain is that the call to FeedbackController.new is returning an AccountController. Ouch. I'm messing something up big time. Each spec runs fine on its own by the way, with the trace as you'd expect. Two questions (perhaps one) 1. I am now using REL_0_6_3; how can I get the benefits of integration testing without this hack please? If I take it out, my cross controller (routed) url's fail. 2. If I have to keep the hack, is it likely that my specs are failing by failing to fail ? In other words - can I trust the output any more? Many thanks, Jerry *** spec_helper.orig 2006-09-29 21:22:40.000000000 +0100 --- spec_helper.rb 2006-09-29 21:29:52.000000000 +0100 *************** *** 27,34 **** class Context def before_context_eval inherit SpecTestCase ! inherit ActionController::IntegrationTest end end end *************** From jerry.west at ntlworld.com Fri Sep 29 18:30:50 2006 From: jerry.west at ntlworld.com (Jerry West) Date: Fri, 29 Sep 2006 23:30:50 +0100 Subject: [Rspec-users] Still living dangerously Message-ID: <451D9E9A.6070708@ntlworld.com> 5 seconds after my last post, I twigged why a call to FeedbackController.new would return an AccountController - the IntegrationTest must intercept the call and sure enough it does: action_controller/integration,rb: 315-339 and rdebug shows that this is indeed the cause. I still don't see how the intercept is established - I can't see where the call to extend ActionController::Base occurs *except* in IntegrationTest::process and if we're calling that why doesn't it also clear the cache (line:235). I told you I didn't know what I doing! More as it develops. But my question still stands - how does one (correctly) write Integration style specs, please? Many thanks, Jerry