From mlangenberg at gmail.com Thu Mar 1 02:44:23 2007 From: mlangenberg at gmail.com (Matthijs Langenberg) Date: Thu, 1 Mar 2007 08:44:23 +0100 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> Message-ID: <27c0ac6d0702282344s27a38ddand55c062825163c11@mail.gmail.com> I'm actually interested in the other way around: when do you know the solution should be receiving a block in a method when writing a specification? Can anyone give me an example of that? On 2/28/07, aslak hellesoy wrote: > On 2/28/07, Ashley Moran wrote: > > Not sure if this is possible currently. > > > > I have a section of code like this: > > > > ActiveRecord::Base.transaction do > > cow.save! > > duck.save! > > dog.save! > > end > > > > (Names changed to protect the innocent.) > > > > I'd like to specify that the saves run in a transaction. I can do > > > > ActiveRecord::Base.should_receive(:transaction).and_yield > > > > But is there any way to specify that the code is called as above, and > > not as > > > > cow.save! > > ActiveRecord::Base.transaction do > > duck.save! > > end > > dog.save! > > > > You can specify order of messages (method calls) on one object > (http://rspec.rubyforge.org/documentation/mocks/mocks.html) but not > between different objects. > > I can't help but feeling that if you're specifying behaviour at this > level of detail you're too specific. You're testing implementation, > not verifying behaviour. > > Aslak > > > ? > > > > Ta > > Ashley > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From work at ashleymoran.me.uk Thu Mar 1 05:01:55 2007 From: work at ashleymoran.me.uk (Ashley Moran) Date: Thu, 1 Mar 2007 10:01:55 +0000 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> Message-ID: <634A7569-C8E8-431E-859A-D41B0C848A9F@ashleymoran.me.uk> On 28 Feb 2007, at 21:27, aslak hellesoy wrote: > You can specify order of messages (method calls) on one object > (http://rspec.rubyforge.org/documentation/mocks/mocks.html) but not > between different objects. > > I can't help but feeling that if you're specifying behaviour at this > level of detail you're too specific. You're testing implementation, > not verifying behaviour. > > Aslak Aslak, I thought about that, but then how can you test that things are being done in the correct transactions? (Which is really important, from where I stand!) The only way would be to involve the database in the tests, raise an exception during the code found in the block and test that the database hasn't been modified. This seems like a step backwards, seeing as everything should be as isolated as possible. Or is the problem that ActiveRecord doesn't have distinct business logic and persistence layers? Ashley From work at ashleymoran.me.uk Thu Mar 1 05:35:13 2007 From: work at ashleymoran.me.uk (Ashley Moran) Date: Thu, 1 Mar 2007 10:35:13 +0000 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <27c0ac6d0702282344s27a38ddand55c062825163c11@mail.gmail.com> References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> <27c0ac6d0702282344s27a38ddand55c062825163c11@mail.gmail.com> Message-ID: <1FE790F0-F5EB-4570-AE7B-AE81809BBE52@ashleymoran.me.uk> On 1 Mar 2007, at 07:44, Matthijs Langenberg wrote: > I'm actually interested in the other way around: when do you know the > solution should be receiving a block in a method when writing a > specification? Can anyone give me an example of that? Best I can think of is this: class MyClass def moo(quack_block) quack(&quack_block) end private def quack puts yield end end context "description of context" do setup do @mock = mock("mock") @my_object = MyClass.new end specify "descriptive specification" do @mock.should_receive(:woof) @my_object.moo(lambda { @mock.woof; "miaow" }) end end Not sure in the real world it would be practical, or even if this is a good thing to do, but it seems to work Ashley From kevwil at gmail.com Thu Mar 1 09:34:08 2007 From: kevwil at gmail.com (Kevin Williams) Date: Thu, 1 Mar 2007 07:34:08 -0700 Subject: [rspec-users] acts_as_authenticated error with Object#id In-Reply-To: <57c63afe0702281602p3b3673f5y46fd0941f82e2001@mail.gmail.com> References: <683a886f0702281419u463a9f62nb8dee4575b410a7f@mail.gmail.com> <57c63afe0702281602p3b3673f5y46fd0941f82e2001@mail.gmail.com> Message-ID: <683a886f0703010634v78352942p41e7c8eb31cd82a6@mail.gmail.com> No, this isn't a mock AFAIK. The 'login_as(:quentin)' code uses the data from the fixtures, so it should be loading from the test database. On 2/28/07, David Chelimsky wrote: > On 2/28/07, Kevin Williams wrote: > > I'm getting this when I run my Rails controller specs. > > > > /config/../lib/authenticated_system.rb:16: warning: Object#id > > will be deprecated; use Object#object_id > > > > I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so > > that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper > > method. Anyone know how to fix this? > > This usually comes from something calling #id on a mock of a model. > Are you mocking any AR models? If so, be sure to > stub!(:id).and_return(a_string). > > David > > > > > > > -- > > Cheers, > > > > Kevin Williams > > http://www.almostserio.us/ > > > > "Any sufficiently advanced technology is indistinguishable from > > Magic." - Arthur C. Clarke > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke From pergesu at gmail.com Thu Mar 1 15:10:50 2007 From: pergesu at gmail.com (Pat Maddox) Date: Thu, 1 Mar 2007 13:10:50 -0700 Subject: [rspec-users] error_on is deprecated? Message-ID: <810a540e0703011210i3ccc33eak3e23fdb897f59516@mail.gmail.com> The docs say DEPRECATED. See Spec::Rails::Expectations model.should_have(:no).errors_on(:attribute) model.should_have(1).error_on(:attribute) model.should_have(3).errors_on(:attribute) However the rdoc for Spec::Rails::Expectations shows the same code. The only difference is that it's "model.should have(1).error_on(:attribute) instead" So is error_on itself deprecated, or is it just the old should_have? The docs aren't very clear to me in that respect. Pat From dchelimsky at gmail.com Thu Mar 1 16:20:22 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 1 Mar 2007 15:20:22 -0600 Subject: [rspec-users] error_on is deprecated? In-Reply-To: <810a540e0703011210i3ccc33eak3e23fdb897f59516@mail.gmail.com> References: <810a540e0703011210i3ccc33eak3e23fdb897f59516@mail.gmail.com> Message-ID: <57c63afe0703011320h56fb56ffr29b72a03f9a122cd@mail.gmail.com> On 3/1/07, Pat Maddox wrote: > The docs say > > DEPRECATED. See Spec::Rails::Expectations > > model.should_have(:no).errors_on(:attribute) > model.should_have(1).error_on(:attribute) > model.should_have(3).errors_on(:attribute) > > However the rdoc for Spec::Rails::Expectations shows the same code. > The only difference is that it's "model.should > have(1).error_on(:attribute) instead" That's a big difference ;) > So is error_on itself deprecated, or is it just the old should_have? It's specifically "should_have". It'll work fine if you use "should have". > The docs aren't very clear to me in that respect. > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From mailing_lists at railsnewbie.com Thu Mar 1 02:48:35 2007 From: mailing_lists at railsnewbie.com (Scott Taylor) Date: Thu, 1 Mar 2007 02:48:35 -0500 Subject: [rspec-users] Problems with RC1 & Rails Controllers Message-ID: <001D8363-9785-4477-B51D-570FD5A2A849@railsnewbie.com> I'm now using the 0.8.0 RC1 gem and have the same version of rspec and rspec_on_rails checked out into my vendor/plugins directory. I'm having a problems with controllers... I've generated a controller using the ./script/generate rspec_controller MyController. When I try to run the rake spec:controller task I get the following: euclid% rake spec:controllers (in /Users/smtlaissezfaire/Sites/rails/dictionary) /opt/local/bin/ruby -I"/Users/smtlaissezfaire/Sites/rails/dictionary/ vendor/plugins/rspec/lib" "/Users/smtlaissezfaire/Sites/rails/ dictionary/vendor/plugins/rspec/bin/spec" "spec/controllers/ my_controller_controller_spec.rb" --options "/Users/smtlaissezfaire/ Sites/rails/dictionary/config/../spec/spec.opts" /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/ errors.rb:94:in `check': SQL logic error or missing database (SQLite3::SQLException) from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/resultset.rb:76:in `check' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/resultset.rb:68:in `commence' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/resultset.rb:61:in `initialize' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/statement.rb:163:in `new' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/statement.rb:163:in `execute' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/database.rb:212:in `execute' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/database.rb:187:in `prepare' from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ lib/sqlite3/database.rb:211:in `execute' ... 29 levels... from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/option_parser.rb:13:in `create_context_runner' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/bin/spec:4 rake aborted! Command failed with status (1): [/opt/local/bin/ruby -I"/Users/ smtlaissezfa...] This looks like the sort of error one would get with a bad fixture file. My only problem is that I can run rake spec:models without a problem. The test log shows this: Spec::Rails::Runner::HelperEvalContextController: missing default helper path spec/rails/runner/helper_eval_context_helper Spec::Rails::Runner::ViewSpecController: missing default helper path spec/rails/runner/view_spec_helper Just to make it clear, I've also run script/generate rspec I'm running OS X.4.8, ruby 1.8.5 (2006-12-25 patchlevel 12) [powerpc-darwin8.8.0] edge rails (revision 6265) and the RC1 gem, as stated before. Let me know If I should post this as a bug report, or if I'm missing something. Best, Scott Taylor From mailing_lists at railsnewbie.com Thu Mar 1 02:58:31 2007 From: mailing_lists at railsnewbie.com (Scott Taylor) Date: Thu, 1 Mar 2007 02:58:31 -0500 Subject: [rspec-users] RC1, Rails, and problems with multiple options in spec.opts Message-ID: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> I am having inconsistent output with multiple options in the spec.opts file. I can, for instance, pass --color or --colour, or, separately, use --drb. But when combining them I get: /opt/local/lib/ruby/1.8/optparse.rb:1381:in `complete': invalid option: --options --color --drb (OptionParser::InvalidOption) from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `catch' from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `complete' from /opt/local/lib/ruby/1.8/optparse.rb:1212:in `order!' from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `catch' from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `order!' from /opt/local/lib/ruby/1.8/optparse.rb:1279:in `permute!' from /opt/local/lib/ruby/1.8/optparse.rb:1300:in `parse!' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' ... 9 levels... from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/option_parser.rb:13:in `create_context_runner' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ plugins/rspec/bin/spec:4 rake aborted! Is anyone else having this problem? I'm on Mac OS X.4.8, using edge rails, ruby 1.8.5, and RC1 Best, Scott Taylor From dchelimsky at gmail.com Thu Mar 1 19:18:42 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 1 Mar 2007 18:18:42 -0600 Subject: [rspec-users] Problems with RC1 & Rails Controllers In-Reply-To: <001D8363-9785-4477-B51D-570FD5A2A849@railsnewbie.com> References: <001D8363-9785-4477-B51D-570FD5A2A849@railsnewbie.com> Message-ID: <57c63afe0703011618l48f9fb1ib4b01b3dd7a7834@mail.gmail.com> On 3/1/07, Scott Taylor wrote: > > I'm now using the 0.8.0 RC1 gem and have the same version of rspec > and rspec_on_rails checked out into my vendor/plugins directory. > > I'm having a problems with controllers... I've generated a controller > using the ./script/generate rspec_controller MyController. When I > try to run the rake spec:controller task I get the following: > > euclid% rake spec:controllers > (in /Users/smtlaissezfaire/Sites/rails/dictionary) > /opt/local/bin/ruby -I"/Users/smtlaissezfaire/Sites/rails/dictionary/ > vendor/plugins/rspec/lib" "/Users/smtlaissezfaire/Sites/rails/ > dictionary/vendor/plugins/rspec/bin/spec" "spec/controllers/ > my_controller_controller_spec.rb" --options "/Users/smtlaissezfaire/ > Sites/rails/dictionary/config/../spec/spec.opts" > > /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/ > errors.rb:94:in `check': SQL logic error or missing database > (SQLite3::SQLException) > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:76:in `check' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:68:in `commence' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:61:in `initialize' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/statement.rb:163:in `new' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/statement.rb:163:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:212:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:187:in `prepare' > from /opt/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:211:in `execute' > ... 29 levels... > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/option_parser.rb:13:in > `create_context_runner' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/bin/spec:4 > rake aborted! > Command failed with status (1): [/opt/local/bin/ruby -I"/Users/ > smtlaissezfa...] > > > This looks like the sort of error one would get with a bad fixture > file. My only problem is that I can run rake spec:models without a > problem. > > The test log shows this: > > Spec::Rails::Runner::HelperEvalContextController: missing default > helper path spec/rails/runner/helper_eval_context_helper > Spec::Rails::Runner::ViewSpecController: missing default helper path > spec/rails/runner/view_spec_helper > > Just to make it clear, I've also run script/generate rspec > > > I'm running OS X.4.8, > ruby 1.8.5 (2006-12-25 patchlevel 12) [powerpc-darwin8.8.0] > edge rails (revision 6265) > and the RC1 gem, as stated before. > > Let me know If I should post this as a bug report, or if I'm missing > something. > > Best, > > Scott Taylor Hi Scott - this was fixed along w/ http://rubyforge.org/tracker/?group_id=797&atid=3149&func=detail&aid=8928. You have two options to address: 1. (recommended) - upgrade to the official release rspec-0.8.1 2. (not recommended, but it will work) - go into lib/spec/rails/runner/context/functional.rb in the rails plugin and remove the call to super at the beginning of setup (line 7). Cheers, David > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From cwdinfo at gmail.com Thu Mar 1 23:03:02 2007 From: cwdinfo at gmail.com (s.ross) Date: Thu, 1 Mar 2007 20:03:02 -0800 Subject: [rspec-users] Installing as Plugin In-Reply-To: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> Message-ID: Big thank-you for allowing rSpec core to be installed as a plugin. I've been on a merry-go-round of updating some 5 active projects to keep up with trunk. Whew! Thanks again. Steve From pergesu at gmail.com Fri Mar 2 05:12:59 2007 From: pergesu at gmail.com (Pat Maddox) Date: Fri, 2 Mar 2007 03:12:59 -0700 Subject: [rspec-users] error_on is deprecated? In-Reply-To: <57c63afe0703011320h56fb56ffr29b72a03f9a122cd@mail.gmail.com> References: <810a540e0703011210i3ccc33eak3e23fdb897f59516@mail.gmail.com> <57c63afe0703011320h56fb56ffr29b72a03f9a122cd@mail.gmail.com> Message-ID: <810a540e0703020212p6e8a96d8seeb24e101e1efa97@mail.gmail.com> On 3/1/07, David Chelimsky wrote: > On 3/1/07, Pat Maddox wrote: > > The docs say > > > > DEPRECATED. See Spec::Rails::Expectations > > > > model.should_have(:no).errors_on(:attribute) > > model.should_have(1).error_on(:attribute) > > model.should_have(3).errors_on(:attribute) > > > > However the rdoc for Spec::Rails::Expectations shows the same code. > > The only difference is that it's "model.should > > have(1).error_on(:attribute) instead" > > That's a big difference ;) I realize there's a huge difference. In fact...let it be known that I've read basically every OOP design book known to man. I've studied them in depth. Despite that, 80% of my understanding of OOP comes from relatively small discussions from David Chelimsky. > > So is error_on itself deprecated, or is it just the old should_have? > > It's specifically "should_have". It'll work fine if you use "should have". That's all I was asking. Pat From keith at dancingtext.com Fri Mar 2 06:02:46 2007 From: keith at dancingtext.com (Keith McDonnell) Date: Fri, 02 Mar 2007 11:02:46 +0000 Subject: [rspec-users] Fixture name not available as class variable in spec In-Reply-To: References: Message-ID: <45E80456.9070608@dancingtext.com> Hi Graham, Thanks for the reply. Yes, I did have the fixtures method included in the contexts. I've recently upgraded to the latest spec, rails plugin & rails which could be an issue. I'd prefer not to have to instantiate the fixture variables in the setup. It was cleaner & more efficient when they were picked up from the fixtures directly. Regards, Keith > Message: 2 > Date: Wed, 28 Feb 2007 08:48:43 -0800 > From: Graeme Nelson > Subject: Re: [rspec-users] Fixture name not available as class > variable in spec > To: rspec-users > Message-ID: <9BA49959-AF93-44F3-8F82-E001B04F8D4F at gmail.com> > Content-Type: text/plain; charset=US-ASCII; format=flowed > > Hello Keith - > > You can get access to your fixtures like so: > > context "Some content" do > > fixtures :users > > setup do > end > > specify "some specification" do > end > end > > Thanks > graeme > > On Feb 28, 2007, at 7:22 AM, Keith McDonnell wrote: > >> Hi there, >> >> I can't seem to access the fixture name as a class variable from my >> specs. I have to set the variable in the spec setup. >> >> ... [fixtures] >> >> my_fixture: >> id: 1 >> >> ... [rpsec] >> >> @my_fixture.id.should == 1 >> >> ... [error] >> >> You have a nil object when you didn't expect it! >> The error occurred while evaluating nil.id >> >> ... [my setup] >> >> RSpec-0.7.5.1 (r1395) - BDD for Ruby >> Rails 1.2.2 >> Latest rspec_on_rails plugin >> >> Is this this a bug or a feature ? >> >> Keith >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > ------------------------------ > > Message: 3 > Date: Wed, 28 Feb 2007 17:26:46 +0000 > From: Ashley Moran > Subject: [rspec-users] Specifying that code is called in a block > To: rspec-users > Message-ID: > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed > > Not sure if this is possible currently. > > I have a section of code like this: > > ActiveRecord::Base.transaction do > cow.save! > duck.save! > dog.save! > end > > (Names changed to protect the innocent.) > > I'd like to specify that the saves run in a transaction. I can do > > ActiveRecord::Base.should_receive(:transaction).and_yield > > But is there any way to specify that the code is called as above, and > not as > > cow.save! > ActiveRecord::Base.transaction do > duck.save! > end > dog.save! > > ? > > Ta > Ashley > > > ------------------------------ > > Message: 4 > Date: Wed, 28 Feb 2007 05:50:44 -0800 (PST) > From: gmcinnes > Subject: Re: [rspec-users] drbspec - "no server running" > To: rspec-users at rubyforge.org > Message-ID: <9204085.post at talk.nabble.com> > Content-Type: text/plain; charset=us-ascii > > > Hi: I can't find the bug report. Maybe you didn't make it yet. > > I solved this by adding my machine name to /etc/localhosts - i.e. my > computer is called morgan, and I added: > > > 127.0.0.1 morgan > > > to that file. > > > It seems os x fancypants name lookup system doesn't resolve the machine > name when making a gethostbyaddr(host)[0] call unless the machine name is in > localhost. Seems to be a drb problem though. > > > > aslak hellesoy wrote: >> On 2/26/07, Scott Taylor wrote: >>> On Feb 26, 2007, at 12:41 AM, aslak hellesoy wrote: >>> >>>> On 2/26/07, Scott Taylor wrote: >>>>> I've created a little 30 second screen cast to show the problem: >>>>> >>>> Hey, that's a neat bug report format! >>>> >>> Well, there is nothing quite like sitting in a room with someone to >>> watch them reproduce the bug; words can be vague. I suppose that >>> this is the closest I'll get to that ideal bug report...(at least >>> over the internet). Plus, I've been looking to put that $70 that >>> I've spent on screencasting software to work. >>> >>> I have my project svn'ed, with an externals on the rspec and >>> rspec_on_rails repositories. I'm at revision 1536 - Is this correct >>> for RC1? Do I also need to update the gem? >>> >> Yes - like it's described on the announcement I linked to. >> >>> Best, >>> >>> Scott >>> >>> >>> >>> >>> >>> >>> >>>> Please try to uninstall your current RSpec release and install 0.8 RC1 >>>> release - I think your problem will be gone. >>>> >>>> http://www.nabble.com/-ANN--RSpec-0.8.0-RC1-t3245509.html >>>> >>>> In 0.8 you have to say spec --drb instead of drbspec (see the >>>> release notes) >>>> >>>> Also, for the future, please remember to tell us what versions of >>>> OS/Ruby/RSpec/Rails you're running. (ok, I could see you have a mac >>>> :-) >>>> >>>> HTH, >>>> Aslak >>>> >>>>> http://railsnewbie.com/files/screencasts/rspec_on_rails- >>>>> no_server_running.mov >>>>> >>>>> All I did before this, as I've said in the previous email, was >>>>> generate a controller with: >>>>> >>>>> ./script/generate rspec_controller -c CollectiveDictionary index show >>>>> >>>>> Best, >>>>> >>>>> Scott >>>>> >>>>> >>>>> On Feb 25, 2007, at 9:22 PM, Scott Taylor wrote: >>>>> >>>>>> At times I've gotten the message "No Server Running" from drbspec >>>>>> with my rails app. The thing is, the drb server certainly is >>>>>> running! >>>>>> >>>>>> This happened a few times with my model specs. I'm not sure exactly >>>>>> what the problem was there - I believe I was loading up fixtures >>>>>> that >>>>>> didn't exist. I was calling fixtures :singular_table_name as >>>>>> opposed >>>>>> to fixtures :plural_table_name >>>>>> >>>>>> This time it happened with my controller. I generated the >>>>>> controller >>>>>> with the ./script/generate rspec_controller ControllerName >>>>>> command... >>>>>> >>>>>> It doesn't appear that the specs are setup to fail to begin with, >>>>>> but >>>>>> if this were the default behavior, one certainly shouldn't see a "No >>>>>> Server Running" >>>>>> >>>>>> I could create a short screen cast if someone would like me to, or >>>>>> elaborate... >>>>>> >>>>>> Best, >>>>>> >>>>>> Scott Taylor >>>>>> >>>>>> _______________________________________________ >>>>>> rspec-users mailing list >>>>>> rspec-users at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>>> _______________________________________________ >>>>> rspec-users mailing list >>>>> rspec-users at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>>> >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-users at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> > From bhelmkamp at gmail.com Fri Mar 2 11:04:48 2007 From: bhelmkamp at gmail.com (Bryan Helmkamp) Date: Fri, 2 Mar 2007 11:04:48 -0500 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> Message-ID: On 2/28/07, aslak hellesoy wrote: > I can't help but feeling that if you're specifying behaviour at this > level of detail you're too specific. You're testing implementation, > not verifying behaviour. Aslak, Is there an alternate solution you'd propose, or would you go without this spec entirely? It's easy to imagine a case where the lack of specifying the need for a transaction could allow a bug. More generally, what metrics do you apply to differentiate between testing implementation and verifying behavior? As I understand it, if one were to follow a strict spec-first style of development, each piece of implementation would have to demanded by a failing spec before it could be written. In this particular case, that would mean not adding the transaction block until there is a unit spec requiring it. How do you reconcile these two seemingly conflicting principles? -Bryan From dchelimsky at gmail.com Fri Mar 2 11:26:26 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Fri, 2 Mar 2007 10:26:26 -0600 Subject: [rspec-users] [ANN] RSpec-0.8.2 Message-ID: <57c63afe0703020826s3914e94euc2aed83134d164b1@mail.gmail.com> Announcing the release of rspec-0.8.2. This should only affect a small number of you, but I re-wrote the assert_select fork as a wrapper. The only effect this has on the API is that :hide and :effect are not supported by "should have_rjs", as they are not supported by assert_select_rjs. You can, however, still use them both with "should_have_rjs" (with an underscore between "should" and "have"). The reason for this change is that only a day after releasing 0.8, I discovered that the specs for should have_rjs were failing against edge rails. I quickly realized that it makes no sense for us to maintain forks of anything in rails. I guess I knew that already, but simply ignored my better judgment when writing the fork because I wanted better messages (the failure messages in assert_select are not that helpful). Thanks for your patience w/ this. David The RSpec Development Team From dchelimsky at gmail.com Fri Mar 2 12:01:33 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Fri, 2 Mar 2007 11:01:33 -0600 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: References: <8d961d900702281327t25cb6c5fwc20452d584417065@mail.gmail.com> Message-ID: <57c63afe0703020901g63369a48uc03b13993a73093e@mail.gmail.com> On 3/2/07, Bryan Helmkamp wrote: > On 2/28/07, aslak hellesoy wrote: > > I can't help but feeling that if you're specifying behaviour at this > > level of detail you're too specific. You're testing implementation, > > not verifying behaviour. > > Aslak, > > Is there an alternate solution you'd propose, or would you go without > this spec entirely? It's easy to imagine a case where the lack of > specifying the need for a transaction could allow a bug. If it's easy to imagine the case, then it _should_ (in theory ;) ) be easy to write a spec that exposes that bug. > More generally, what metrics do you apply to differentiate between > testing implementation and verifying behavior? > > As I understand it, if one were to follow a strict spec-first style of > development, each piece of implementation would have to demanded by a > failing spec before it could be written. In this particular case, that > would mean not adding the transaction block until there is a unit spec > requiring it. How do you reconcile these two seemingly conflicting > principles? TDD is not a perfect world, and BDD certainly does not make it so. There are cases in which we know things are important and we do some ugly things to test them. Bob Martin puts something similar into perspective talking about comments. He says that once in a while he'll put a comment somewhere because it is more pragmatic to have the comment than any alternative, but that he views that as a failure. He doesn't let it stop the world. He simply acknowledges that something is wrong and presses on. Similarly, in this case, absent a viable solution using the available tools, I'd probably do some nasty stuff to spec this out, but catalog that in the back of my mind as a failure of some combination of my skill and the available toolset. Tools like rspec are there to help you, and often do. But when they don't, you can't let that be an excuse for not producing software that is solid, maintainable, and meets the requirements at hand. David > > -Bryan > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From meadow.nnick at gmail.com Fri Mar 2 12:41:47 2007 From: meadow.nnick at gmail.com (Lugovoi Nikolai) Date: Fri, 2 Mar 2007 19:41:47 +0200 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: References: Message-ID: <86924770703020941v6b1ce9c2j185e42d633b3718b@mail.gmail.com> What about such specification? specify "cow, dog and duck must be saved in the same transaction" do $log.clear @connection.stub!(:begin_db_transaction).and_return { $log.record("BEGIN"); nil } @connection.stub!(:commit_db_transaction).and_return { $log.record("COMMIT"); nil } @cow.stub!(:save!).and_return {$log.record("COW SAVE"); true} @dog.stub!(:save!).and_return {$log.record("DOG SAVE"); true} @duck.stub!(:save!).and_return {$log.record("DUCK SAVE"); true} @tested_object.exec_method_about_cow_dog_and_duck txn_intervals = %w(COW DUCK DOG).collect do |beast| [ $log.find("BEGIN", :before, "#{beast} SAVE"), $log.find("COMMIT", :after, "#{beast} SAVE")] end txn_intervals.each do |range| range[0].should_be kind_of(Time) range[1].should_be kind_of(Time) end txn_intervals.uniq.size.should == 1 end where $log can be something like: $log = Struct.new(:events, :timestamps).new def $log.clear events = [] timestamps = [] end def $log.record(what) events << what timestamps << Time.now end def $log.find(what, where, start) # return timestamp of event `what' that is :before or :after (where) event `start' end 2007/2/28, Ashley Moran : > Not sure if this is possible currently. > > I have a section of code like this: > > ActiveRecord::Base.transaction do > cow.save! > duck.save! > dog.save! > end > > (Names changed to protect the innocent.) > > I'd like to specify that the saves run in a transaction. I can do > > ActiveRecord::Base.should_receive(:transaction).and_yield > > But is there any way to specify that the code is called as above, and > not as > > cow.save! > ActiveRecord::Base.transaction do > duck.save! > end > dog.save! > > ? > > Ta > Ashley > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From david.smalley.lists at googlemail.com Fri Mar 2 13:18:58 2007 From: david.smalley.lists at googlemail.com (David Smalley) Date: Fri, 2 Mar 2007 18:18:58 +0000 Subject: [rspec-users] database modifications not rolling back Message-ID: Hi, Since moving this morning from 0.7.5.1 to 0.8.2 I've hit some problems and I'm not sure if it's something I'm doing wrong or a change in 0.8.2 Basically I dislike fixtures so I have been using a helper method to create an object I need frequently and setting it up in the setup method, in 0.7.5.1 this all worked fine - but since moving to 0.8.2 I'm finding that the records are not removed from the database after each spec, leading to a failure on the next attempt to create the identical record (there is some uniqueness validation on the model). After all tests have finished the test database is populated entirely with all the records I have created, whereas on 0.7.5.1 I'd find this database completely empty on completion. FYI - I'm using Rspec 0.8.2 with matching revision of rspec_on_rails, Rails 1.2.2 and Mysql. spec_helper.rb module CompetitionSpecHelper def new_competition code_to_create_a_new_competition return the competition end end competition_spec.rb require File.dirname(__FILE__) + '/../spec_helper' context "Given a visible competition" do include CompetitionSpecHelper setup do @competition = new_competition @competition.process! end specify "should return true for started?" do @competition.started? should == true end ...................... Is there something wrong with what I have been doing? All tests were passing before the upgrade, it'll take me a while to go through and change to fixtures if this isn't the correct way to do it. I had seen numerous discussion around Rspec that seemed to validate the way I've been doing things, in spirit at least. Thanks, David From dchelimsky at gmail.com Fri Mar 2 14:09:01 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Fri, 2 Mar 2007 13:09:01 -0600 Subject: [rspec-users] database modifications not rolling back In-Reply-To: References: Message-ID: <57c63afe0703021109u4687729y98d122a091d7ae8e@mail.gmail.com> did you run script/generate rspec? There's a new structure in spec_helper.rb. You may need to blow away your test db and recreate it because you've added records to it now. Please let us know if that does the trick. Cheers, David On 3/2/07, David Smalley wrote: > Hi, > > Since moving this morning from 0.7.5.1 to 0.8.2 I've hit some > problems and I'm not sure if it's something I'm doing wrong or a > change in 0.8.2 > > Basically I dislike fixtures so I have been using a helper method to > create an object I need frequently and setting it up in the setup > method, in 0.7.5.1 this all worked fine - but since moving to 0.8.2 > I'm finding that the records are not removed from the database after > each spec, leading to a failure on the next attempt to create the > identical record (there is some uniqueness validation on the model). > After all tests have finished the test database is populated entirely > with all the records I have created, whereas on 0.7.5.1 I'd find this > database completely empty on completion. > > FYI - I'm using Rspec 0.8.2 with matching revision of rspec_on_rails, > Rails 1.2.2 and Mysql. > > > spec_helper.rb > > module CompetitionSpecHelper > def new_competition > code_to_create_a_new_competition > return the competition > end > end > > > competition_spec.rb > > require File.dirname(__FILE__) + '/../spec_helper' > > context "Given a visible competition" do > include CompetitionSpecHelper > > setup do > @competition = new_competition > @competition.process! > end > > specify "should return true for started?" do > @competition.started? should == true > end > ...................... > > > Is there something wrong with what I have been doing? All tests were > passing before the upgrade, it'll take me a while to go through and > change to fixtures if this isn't the correct way to do it. I had seen > numerous discussion around Rspec that seemed to validate the way I've > been doing things, in spirit at least. > > Thanks, > > David > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From david.smalley.lists at googlemail.com Fri Mar 2 17:29:30 2007 From: david.smalley.lists at googlemail.com (David Smalley) Date: Fri, 2 Mar 2007 22:29:30 +0000 Subject: [rspec-users] database modifications not rolling back In-Reply-To: <57c63afe0703021109u4687729y98d122a091d7ae8e@mail.gmail.com> References: <57c63afe0703021109u4687729y98d122a091d7ae8e@mail.gmail.com> Message-ID: <2AEB35E4-E9C1-4AD7-9AB3-3A909F8E7796@googlemail.com> On 2 Mar 2007, at 19:09, David Chelimsky wrote: > did you run script/generate rspec? D'oh > > There's a new structure in spec_helper.rb. > > You may need to blow away your test db and recreate it because you've > added records to it now. > > Please let us know if that does the trick. Yes, that did the trick - I feel silly missing that. Thanks David -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070302/40eb03c0/attachment.html From cwdinfo at gmail.com Sat Mar 3 18:07:12 2007 From: cwdinfo at gmail.com (s.ross) Date: Sat, 3 Mar 2007 15:07:12 -0800 Subject: [rspec-users] ignoring attempt to close td with tr ??? Message-ID: <1509F83D-05E3-424B-B3BA-8C5A74594333@gmail.com> I got the most current rspec and installed as a plugin. Running rake spec:controllers gives me this error: ignoring attempt to close td with tr I dumped response.body and everything looks fine. Is this a known issue? Nothing in Google about it. Thanks, Steve From dchelimsky at gmail.com Sat Mar 3 18:36:00 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Sat, 3 Mar 2007 17:36:00 -0600 Subject: [rspec-users] ignoring attempt to close td with tr ??? In-Reply-To: <1509F83D-05E3-424B-B3BA-8C5A74594333@gmail.com> References: <1509F83D-05E3-424B-B3BA-8C5A74594333@gmail.com> Message-ID: <57c63afe0703031536q35d94195x12b49fb0cf7ff313@mail.gmail.com> On 3/3/07, s.ross wrote: > I got the most current rspec and installed as a plugin. Running rake > spec:controllers gives me this error: > > ignoring attempt to close td with tr > > I dumped response.body and everything looks fine. Is this a known > issue? Nothing in Google about it. There is certainly nothing in rspec that produces that error directly. Any chance you also updated other plugins at the same time? Or rails? > > Thanks, > > Steve > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From cwdinfo at gmail.com Sat Mar 3 23:39:46 2007 From: cwdinfo at gmail.com (s.ross) Date: Sat, 3 Mar 2007 20:39:46 -0800 Subject: [rspec-users] ignoring attempt to close td with tr ??? In-Reply-To: <57c63afe0703031536q35d94195x12b49fb0cf7ff313@mail.gmail.com> References: <1509F83D-05E3-424B-B3BA-8C5A74594333@gmail.com> <57c63afe0703031536q35d94195x12b49fb0cf7ff313@mail.gmail.com> Message-ID: <8FDC6E50-D1D8-458C-BE9C-11E1A6D6FAEA@gmail.com> Aha! I found the problem. It actually was a markup issue that the validator missed :( Is the output from hPricot? Thanks, Steve On Mar 3, 2007, at 3:36 PM, David Chelimsky wrote: > On 3/3/07, s.ross wrote: >> I got the most current rspec and installed as a plugin. Running rake >> spec:controllers gives me this error: >> >> ignoring attempt to close td with tr >> >> I dumped response.body and everything looks fine. Is this a known >> issue? Nothing in Google about it. > > There is certainly nothing in rspec that produces that error directly. > Any chance you also updated other plugins at the same time? Or rails? > >> >> Thanks, >> >> Steve >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From francois.beausoleil at gmail.com Sun Mar 4 23:08:10 2007 From: francois.beausoleil at gmail.com (=?UTF-8?Q?Fran=C3=A7ois_Beausoleil?=) Date: Sun, 4 Mar 2007 23:08:10 -0500 Subject: [rspec-users] ignoring attempt to close td with tr ??? In-Reply-To: <8FDC6E50-D1D8-458C-BE9C-11E1A6D6FAEA@gmail.com> References: <1509F83D-05E3-424B-B3BA-8C5A74594333@gmail.com> <57c63afe0703031536q35d94195x12b49fb0cf7ff313@mail.gmail.com> <8FDC6E50-D1D8-458C-BE9C-11E1A6D6FAEA@gmail.com> Message-ID: <41d5fadf0703042008k5cb5fd28i47a9edc459fec026@mail.gmail.com> Hi ! 2007/3/3, s.ross : > Aha! I found the problem. It actually was a markup issue that the > validator missed :( > > Is the output from hPricot? No, the output comes from Rails bundled HTML parser. Look in vendor/rails/actionpack/**/vendor/ Bye ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ From JohnnyButler7 at gmail.com Tue Mar 6 04:05:22 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Tue, 6 Mar 2007 01:05:22 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" Message-ID: <9328370.post@talk.nabble.com> Hi, Hi I am trying to use RSPEC on windows and i keep getting the following error "You must gem install win32console to use colour on Windows" I have installed this Gem but i am still getting the same error. The file that error is coming from is: C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb Do i need to put this line of code in? Where do i put it? require 'Win32/Console/ANSI' Can anyone help me, ive searched the web but cant seem to find a solution. JB -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 Sent from the rspec-users mailing list archive at Nabble.com. From JohnnyButler7 at gmail.com Tue Mar 6 05:13:10 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Tue, 6 Mar 2007 02:13:10 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9328370.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> Message-ID: <9328875.post@talk.nabble.com> I have removed the --colour from the spec.opts file to see if it was just a colour problem. I now get this error below, i am using rails 1.2.2: ** Execute spec:models C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" "spec/models/user_spec.rb" --options "C:/Documents and Settings/JohnButler/My Documents/Ruby on Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in `run': File or directory not found: (RuntimeError) from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in `each' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in `run' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in `parse' from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in `parse' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in `create_context_runner' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in `run' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 ** Invoke spec:controllers (first_time) ** Invoke db:test:prepare ** Execute spec:controllers ** Invoke spec:helpers (first_time) ** Invoke db:test:prepare ** Execute spec:helpers ** Invoke spec:views (first_time) ** Invoke db:test:prepare ** Execute spec:views rake aborted! RSpec failures C:/Documents and Settings/JohnButler/My Documents/Ruby on Rails/eclipse/workspace/Workspace/sports/config/../vendor/plugins/rspec_on_rails/tasks/rspec.rake:32 C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 -e:3:in `load' -e:3 I really want to use RSpec with my rails development but cant it running properly. JB johnnybutler7 wrote: > > Hi, > > Hi I am trying to use RSPEC on windows and i keep getting the following > error > > "You must gem install win32console to use colour on Windows" > > I have installed this Gem but i am still getting the same error. The > file that error is coming from is: > C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > > Do i need to put this line of code in? Where do i put it? > require 'Win32/Console/ANSI' > > Can anyone help me, ive searched the web but cant seem to find a > solution. > > JB > -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328875 Sent from the rspec-users mailing list archive at Nabble.com. From dchelimsky at gmail.com Tue Mar 6 08:19:24 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Tue, 6 Mar 2007 07:19:24 -0600 Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9328370.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> Message-ID: <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> On 3/6/07, johnnybutler7 wrote: > > Hi, > > Hi I am trying to use RSPEC on windows and i keep getting the following > error > > "You must gem install win32console to use colour on Windows" > > I have installed this Gem but i am still getting the same error. The > file that error is coming from is: > C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb That line reads as follows: begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ ; rescue LoadError ; raise "You must gem install win32console to use colour on Windows" ; end So it seems odd that your rspec was complaining even after you installed the plugin. There are people are using rspec on windows w/ some success, so I'm not convinced the problem is in rspec alone - it seems to be in rspec in conjunction w/ your particular system. Any chance you recently upgraded to Vista? Maybe the environment variables have changed? David > > Do i need to put this line of code in? Where do i put it? > require 'Win32/Console/ANSI' > > Can anyone help me, ive searched the web but cant seem to find a > solution. > > JB > -- > View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From JohnnyButler7 at gmail.com Tue Mar 6 08:47:19 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Tue, 6 Mar 2007 05:47:19 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9328875.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> <9328875.post@talk.nabble.com> Message-ID: <9332300.post@talk.nabble.com> Thanks for your reply. No i have not upgraded to Vista, im still on windows XP. I only installed rspec yesterday and think i have followed the instructions correctly from here http://rspec.rubyforge.org/documentation/rails/install.html. I am running rails 1.2.2 which may be different to current rspec rails windows users. Im stll have the same problems mentioned in the last posts. Im really stumped now. John B johnnybutler7 wrote: > > I have removed the --colour from the spec.opts file to see if it was just > a colour problem. > > I now get this error below, i am using rails 1.2.2: > > ** Execute spec:models > C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" > "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" > "spec/models/user_spec.rb" --options "C:/Documents and > Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in > `run': File or directory not found: (RuntimeError) > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `each' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `run' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in > `parse' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in > `parse' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in > `create_context_runner' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in > `run' > from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 > ** Invoke spec:controllers (first_time) > ** Invoke db:test:prepare > ** Execute spec:controllers > ** Invoke spec:helpers (first_time) > ** Invoke db:test:prepare > ** Execute spec:helpers > ** Invoke spec:views (first_time) > ** Invoke db:test:prepare > ** Execute spec:views > rake aborted! > RSpec failures > C:/Documents and Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports/config/../vendor/plugins/rspec_on_rails/tasks/rspec.rake:32 > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' > C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 > -e:3:in `load' > -e:3 > > I really want to use RSpec with my rails development but cant it running > properly. > > JB > > > > > > johnnybutler7 wrote: >> >> Hi, >> >> Hi I am trying to use RSPEC on windows and i keep getting the following >> error >> >> "You must gem install win32console to use colour on Windows" >> >> I have installed this Gem but i am still getting the same error. The >> file that error is coming from is: >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb >> >> Do i need to put this line of code in? Where do i put it? >> require 'Win32/Console/ANSI' >> >> Can anyone help me, ive searched the web but cant seem to find a >> solution. >> >> JB >> > > -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9332300 Sent from the rspec-users mailing list archive at Nabble.com. From JohnnyButler7 at gmail.com Tue Mar 6 09:58:00 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Tue, 6 Mar 2007 06:58:00 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> Message-ID: <9333516.post@talk.nabble.com> Hi, i have got RSpec to work on my machine now. I created a new app and followed the instructions again. If i navigate to the spec folder int he rails directory and type spec user_spec.rb then this works fine. If i try the rake command rake spec:models first of all i get the "gem install win32console", so if i remove the --colour from the options i get the error i posted above. Its basically saying it cannot find the spec files. Do i need to set the path somehwere so when i do a rake spec:models it knows where to find them? John B David Chelimsky-2 wrote: > > On 3/6/07, johnnybutler7 wrote: >> >> Hi, >> >> Hi I am trying to use RSPEC on windows and i keep getting the following >> error >> >> "You must gem install win32console to use colour on Windows" >> >> I have installed this Gem but i am still getting the same error. The >> file that error is coming from is: >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > > That line reads as follows: > > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ > ; rescue LoadError ; raise "You must gem install win32console to use > colour on Windows" ; end > > So it seems odd that your rspec was complaining even after you > installed the plugin. There are people are using rspec on windows w/ > some success, so I'm not convinced the problem is in rspec alone - it > seems to be in rspec in conjunction w/ your particular system. > > Any chance you recently upgraded to Vista? Maybe the environment > variables have changed? > > David > >> >> Do i need to put this line of code in? Where do i put it? >> require 'Win32/Console/ANSI' >> >> Can anyone help me, ive searched the web but cant seem to find a >> solution. >> >> JB >> -- >> View this message in context: >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 >> Sent from the rspec-users mailing list archive at Nabble.com. >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 Sent from the rspec-users mailing list archive at Nabble.com. From dchelimsky at gmail.com Tue Mar 6 10:01:40 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Tue, 6 Mar 2007 09:01:40 -0600 Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9333516.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> Message-ID: <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> On 3/6/07, johnnybutler7 wrote: > > Hi, > > i have got RSpec to work on my machine now. I created a new app and > followed the instructions again. If i navigate to the spec folder int he > rails directory and type spec user_spec.rb then this works fine. If i try > the rake command > > rake spec:models This rake task assumes model specs are in spec/models. Is user_spec.rb at spec/models/user_spec.rb? > > first of all i get the "gem install win32console", so if i remove the > --colour from the options i get the error i posted above. Its basically > saying it cannot find the spec files. Do i need to set the path somehwere > so when i do a rake spec:models it knows where to find them? > > John B > > > > > David Chelimsky-2 wrote: > > > > On 3/6/07, johnnybutler7 wrote: > >> > >> Hi, > >> > >> Hi I am trying to use RSPEC on windows and i keep getting the following > >> error > >> > >> "You must gem install win32console to use colour on Windows" > >> > >> I have installed this Gem but i am still getting the same error. The > >> file that error is coming from is: > >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > > > > That line reads as follows: > > > > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ > > ; rescue LoadError ; raise "You must gem install win32console to use > > colour on Windows" ; end > > > > So it seems odd that your rspec was complaining even after you > > installed the plugin. There are people are using rspec on windows w/ > > some success, so I'm not convinced the problem is in rspec alone - it > > seems to be in rspec in conjunction w/ your particular system. > > > > Any chance you recently upgraded to Vista? Maybe the environment > > variables have changed? > > > > David > > > >> > >> Do i need to put this line of code in? Where do i put it? > >> require 'Win32/Console/ANSI' > >> > >> Can anyone help me, ive searched the web but cant seem to find a > >> solution. > >> > >> JB > >> -- > >> View this message in context: > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 > >> Sent from the rspec-users mailing list archive at Nabble.com. > >> > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From JohnnyButler7 at gmail.com Tue Mar 6 10:51:24 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Tue, 6 Mar 2007 07:51:24 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> Message-ID: <9334771.post@talk.nabble.com> Yes, thats why i cant understand why i am getting this error message. I used ./script/generate rspec_model User and that created the user_spec.rb file in the spec/models folder. This is the full message with --trace (in C:/Documents and Settings/JohnButler/My Documents/Ruby on Rails/eclipse/workspace/Workspace/sports) ** Invoke spec:models (first_time) ** Invoke db:test:prepare (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:test:prepare ** Invoke db:test:clone (first_time) ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:clone ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load ** Execute spec:models C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" "spec/models/user_spec.rb" --options "C:/Documents and Settings/JohnButler/My Documents/Ruby on Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in `run': File or directory not found: (RuntimeError) from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in `each' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in `run' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in `parse' from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in `parse' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in `create_context_runner' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in `run' from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 rake aborted! Command failed with status (1): [C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/...] C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby' C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:126:in `define' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose' C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:105:in `define' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 -e:3:in `load' -e:3 David Chelimsky-2 wrote: > > On 3/6/07, johnnybutler7 wrote: >> >> Hi, >> >> i have got RSpec to work on my machine now. I created a new app and >> followed the instructions again. If i navigate to the spec folder int he >> rails directory and type spec user_spec.rb then this works fine. If i >> try >> the rake command >> >> rake spec:models > > This rake task assumes model specs are in spec/models. Is user_spec.rb > at spec/models/user_spec.rb? > >> >> first of all i get the "gem install win32console", so if i remove the >> --colour from the options i get the error i posted above. Its basically >> saying it cannot find the spec files. Do i need to set the path >> somehwere >> so when i do a rake spec:models it knows where to find them? >> >> John B >> >> >> >> >> David Chelimsky-2 wrote: >> > >> > On 3/6/07, johnnybutler7 wrote: >> >> >> >> Hi, >> >> >> >> Hi I am trying to use RSPEC on windows and i keep getting the >> following >> >> error >> >> >> >> "You must gem install win32console to use colour on Windows" >> >> >> >> I have installed this Gem but i am still getting the same error. The >> >> file that error is coming from is: >> >> >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb >> > >> > That line reads as follows: >> > >> > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ >> > ; rescue LoadError ; raise "You must gem install win32console to use >> > colour on Windows" ; end >> > >> > So it seems odd that your rspec was complaining even after you >> > installed the plugin. There are people are using rspec on windows w/ >> > some success, so I'm not convinced the problem is in rspec alone - it >> > seems to be in rspec in conjunction w/ your particular system. >> > >> > Any chance you recently upgraded to Vista? Maybe the environment >> > variables have changed? >> > >> > David >> > >> >> >> >> Do i need to put this line of code in? Where do i put it? >> >> require 'Win32/Console/ANSI' >> >> >> >> Can anyone help me, ive searched the web but cant seem to find a >> >> solution. >> >> >> >> JB >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 >> >> Sent from the rspec-users mailing list archive at Nabble.com. >> >> >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-users at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-users at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 >> Sent from the rspec-users mailing list archive at Nabble.com. >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9334771 Sent from the rspec-users mailing list archive at Nabble.com. From dchelimsky at gmail.com Tue Mar 6 11:43:08 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Tue, 6 Mar 2007 10:43:08 -0600 Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9334771.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> <9334771.post@talk.nabble.com> Message-ID: <57c63afe0703060843y36b8b0cet37d3aa33835e909c@mail.gmail.com> On 3/6/07, johnnybutler7 wrote: > > Yes, thats why i cant understand why i am getting this error message. I > used ./script/generate rspec_model User and that created the user_spec.rb > file in the spec/models folder. Unfortunately (or fortunately, depending on your view), I don't have a winbox w/ everything set up to troubleshoot this. Is there anyone else on the list who can chime in who is successfully using Spec::Rails 0.8, Rails 1.2.2 on windows? > > This is the full message with --trace > > (in C:/Documents and Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports) > ** Invoke spec:models (first_time) > ** Invoke db:test:prepare (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:test:prepare > ** Invoke db:test:clone (first_time) > ** Invoke db:schema:dump (first_time) > ** Invoke environment > ** Execute db:schema:dump > ** Invoke db:test:purge (first_time) > ** Invoke environment > ** Execute db:test:purge > ** Execute db:test:clone > ** Invoke db:schema:load (first_time) > ** Invoke environment > ** Execute db:schema:load > ** Execute spec:models > C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" > "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" > "spec/models/user_spec.rb" --options "C:/Documents and > Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in > `run': File or directory not found: (RuntimeError) > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `each' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `run' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in > `parse' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in > `parse' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in > `create_context_runner' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in > `run' > from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 > rake aborted! > Command failed with status (1): [C:/ruby/bin/ruby > -I"C:/ruby/lib/ruby/gems/...] > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby' > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:126:in > `define' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose' > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:105:in > `define' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' > C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 > -e:3:in `load' > -e:3 > > > > David Chelimsky-2 wrote: > > > > On 3/6/07, johnnybutler7 wrote: > >> > >> Hi, > >> > >> i have got RSpec to work on my machine now. I created a new app and > >> followed the instructions again. If i navigate to the spec folder int he > >> rails directory and type spec user_spec.rb then this works fine. If i > >> try > >> the rake command > >> > >> rake spec:models > > > > This rake task assumes model specs are in spec/models. Is user_spec.rb > > at spec/models/user_spec.rb? > > > >> > >> first of all i get the "gem install win32console", so if i remove the > >> --colour from the options i get the error i posted above. Its basically > >> saying it cannot find the spec files. Do i need to set the path > >> somehwere > >> so when i do a rake spec:models it knows where to find them? > >> > >> John B > >> > >> > >> > >> > >> David Chelimsky-2 wrote: > >> > > >> > On 3/6/07, johnnybutler7 wrote: > >> >> > >> >> Hi, > >> >> > >> >> Hi I am trying to use RSPEC on windows and i keep getting the > >> following > >> >> error > >> >> > >> >> "You must gem install win32console to use colour on Windows" > >> >> > >> >> I have installed this Gem but i am still getting the same error. The > >> >> file that error is coming from is: > >> >> > >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > >> > > >> > That line reads as follows: > >> > > >> > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ > >> > ; rescue LoadError ; raise "You must gem install win32console to use > >> > colour on Windows" ; end > >> > > >> > So it seems odd that your rspec was complaining even after you > >> > installed the plugin. There are people are using rspec on windows w/ > >> > some success, so I'm not convinced the problem is in rspec alone - it > >> > seems to be in rspec in conjunction w/ your particular system. > >> > > >> > Any chance you recently upgraded to Vista? Maybe the environment > >> > variables have changed? > >> > > >> > David > >> > > >> >> > >> >> Do i need to put this line of code in? Where do i put it? > >> >> require 'Win32/Console/ANSI' > >> >> > >> >> Can anyone help me, ive searched the web but cant seem to find a > >> >> solution. > >> >> > >> >> JB > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 > >> >> Sent from the rspec-users mailing list archive at Nabble.com. > >> >> > >> >> _______________________________________________ > >> >> rspec-users mailing list > >> >> rspec-users at rubyforge.org > >> >> http://rubyforge.org/mailman/listinfo/rspec-users > >> >> > >> > _______________________________________________ > >> > rspec-users mailing list > >> > rspec-users at rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/rspec-users > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 > >> Sent from the rspec-users mailing list archive at Nabble.com. > >> > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9334771 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From kevwil at gmail.com Tue Mar 6 13:33:47 2007 From: kevwil at gmail.com (Kevin Williams) Date: Tue, 6 Mar 2007 11:33:47 -0700 Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <57c63afe0703060843y36b8b0cet37d3aa33835e909c@mail.gmail.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> <9334771.post@talk.nabble.com> <57c63afe0703060843y36b8b0cet37d3aa33835e909c@mail.gmail.com> Message-ID: <683a886f0703061033n292c0e21nd8ef31cf44db8c12@mail.gmail.com> My rails app seems to be broken today (pgsql 8.2 problem), but I ran the specs successfully yesterday. Rails 1.2.2, rspec 0.8.2, win32console 1.0.8. I'm kind of a power user though. My Start => All Programs menu fills my entire screen, and I have all the UnxUtils binaries in my path. :-] On 3/6/07, David Chelimsky wrote: > On 3/6/07, johnnybutler7 wrote: > > > > Yes, thats why i cant understand why i am getting this error message. I > > used ./script/generate rspec_model User and that created the user_spec.rb > > file in the spec/models folder. > > Unfortunately (or fortunately, depending on your view), I don't have a > winbox w/ everything set up to troubleshoot this. Is there anyone > else on the list who can chime in who is successfully using > Spec::Rails 0.8, Rails 1.2.2 on windows? > > > > > This is the full message with --trace > > > > (in C:/Documents and Settings/JohnButler/My Documents/Ruby on > > Rails/eclipse/workspace/Workspace/sports) > > ** Invoke spec:models (first_time) > > ** Invoke db:test:prepare (first_time) > > ** Invoke environment (first_time) > > ** Execute environment > > ** Execute db:test:prepare > > ** Invoke db:test:clone (first_time) > > ** Invoke db:schema:dump (first_time) > > ** Invoke environment > > ** Execute db:schema:dump > > ** Invoke db:test:purge (first_time) > > ** Invoke environment > > ** Execute db:test:purge > > ** Execute db:test:clone > > ** Invoke db:schema:load (first_time) > > ** Invoke environment > > ** Execute db:schema:load > > ** Execute spec:models > > C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" > > "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" > > "spec/models/user_spec.rb" --options "C:/Documents and > > Settings/JohnButler/My Documents/Ruby on > > Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in > > `run': File or directory not found: (RuntimeError) > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > > `each' > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > > `run' > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in > > `parse' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' > > from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in > > `parse' > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in > > `create_context_runner' > > from > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in > > `run' > > from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 > > rake aborted! > > Command failed with status (1): [C:/ruby/bin/ruby > > -I"C:/ruby/lib/ruby/gems/...] > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby' > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:126:in > > `define' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose' > > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:105:in > > `define' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' > > C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' > > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > > C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 > > -e:3:in `load' > > -e:3 > > > > > > > > David Chelimsky-2 wrote: > > > > > > On 3/6/07, johnnybutler7 wrote: > > >> > > >> Hi, > > >> > > >> i have got RSpec to work on my machine now. I created a new app and > > >> followed the instructions again. If i navigate to the spec folder int he > > >> rails directory and type spec user_spec.rb then this works fine. If i > > >> try > > >> the rake command > > >> > > >> rake spec:models > > > > > > This rake task assumes model specs are in spec/models. Is user_spec.rb > > > at spec/models/user_spec.rb? > > > > > >> > > >> first of all i get the "gem install win32console", so if i remove the > > >> --colour from the options i get the error i posted above. Its basically > > >> saying it cannot find the spec files. Do i need to set the path > > >> somehwere > > >> so when i do a rake spec:models it knows where to find them? > > >> > > >> John B > > >> > > >> > > >> > > >> > > >> David Chelimsky-2 wrote: > > >> > > > >> > On 3/6/07, johnnybutler7 wrote: > > >> >> > > >> >> Hi, > > >> >> > > >> >> Hi I am trying to use RSPEC on windows and i keep getting the > > >> following > > >> >> error > > >> >> > > >> >> "You must gem install win32console to use colour on Windows" > > >> >> > > >> >> I have installed this Gem but i am still getting the same error. The > > >> >> file that error is coming from is: > > >> >> > > >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > > >> > > > >> > That line reads as follows: > > >> > > > >> > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ > > >> > ; rescue LoadError ; raise "You must gem install win32console to use > > >> > colour on Windows" ; end > > >> > > > >> > So it seems odd that your rspec was complaining even after you > > >> > installed the plugin. There are people are using rspec on windows w/ > > >> > some success, so I'm not convinced the problem is in rspec alone - it > > >> > seems to be in rspec in conjunction w/ your particular system. > > >> > > > >> > Any chance you recently upgraded to Vista? Maybe the environment > > >> > variables have changed? > > >> > > > >> > David > > >> > > > >> >> > > >> >> Do i need to put this line of code in? Where do i put it? > > >> >> require 'Win32/Console/ANSI' > > >> >> > > >> >> Can anyone help me, ive searched the web but cant seem to find a > > >> >> solution. > > >> >> > > >> >> JB > > >> >> -- > > >> >> View this message in context: > > >> >> > > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 > > >> >> Sent from the rspec-users mailing list archive at Nabble.com. > > >> >> > > >> >> _______________________________________________ > > >> >> rspec-users mailing list > > >> >> rspec-users at rubyforge.org > > >> >> http://rubyforge.org/mailman/listinfo/rspec-users > > >> >> > > >> > _______________________________________________ > > >> > rspec-users mailing list > > >> > rspec-users at rubyforge.org > > >> > http://rubyforge.org/mailman/listinfo/rspec-users > > >> > > > >> > > > >> > > >> -- > > >> View this message in context: > > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 > > >> Sent from the rspec-users mailing list archive at Nabble.com. > > >> > > >> _______________________________________________ > > >> rspec-users mailing list > > >> rspec-users at rubyforge.org > > >> http://rubyforge.org/mailman/listinfo/rspec-users > > >> > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > > > > -- > > View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9334771 > > Sent from the rspec-users mailing list archive at Nabble.com. > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke From aslak.hellesoy at gmail.com Tue Mar 6 17:19:54 2007 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Tue, 6 Mar 2007 16:19:54 -0600 Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <9334771.post@talk.nabble.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> <9334771.post@talk.nabble.com> Message-ID: <8d961d900703061419ydcd8306u3022045bbd5537b7@mail.gmail.com> On 3/6/07, johnnybutler7 wrote: > > Yes, thats why i cant understand why i am getting this error message. I > used ./script/generate rspec_model User and that created the user_spec.rb > file in the spec/models folder. > > This is the full message with --trace > The exception you are getting is thrown from line 26 in command_line.rb (http://rubyforge.org/viewvc/tags/REL_0_8_2/rspec/lib/spec/runner/command_line.rb?revision=1561&root=rspec&view=markup) Looking at line 26 of that file and the error message you are getting: "File or directory not found: (RuntimeError)" it looks like the file_or_dir variable in command_line.rb is nil or an empty string. I see you have lots of spaces in your paths. This could be the source of the problem. Please try to run your code from a path without spaces, then report back. It will tell us whether we should hunt for a bug related to spaces in filenames or something else. Thanks, Aslak > (in C:/Documents and Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports) > ** Invoke spec:models (first_time) > ** Invoke db:test:prepare (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:test:prepare > ** Invoke db:test:clone (first_time) > ** Invoke db:schema:dump (first_time) > ** Invoke environment > ** Execute db:schema:dump > ** Invoke db:test:purge (first_time) > ** Invoke environment > ** Execute db:test:purge > ** Execute db:test:clone > ** Invoke db:schema:load (first_time) > ** Invoke environment > ** Execute db:schema:load > ** Execute spec:models > C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" > "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" > "spec/models/user_spec.rb" --options "C:/Documents and > Settings/JohnButler/My Documents/Ruby on > Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in > `run': File or directory not found: (RuntimeError) > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `each' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in > `run' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in > `parse' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' > from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in > `parse' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in > `create_context_runner' > from > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in > `run' > from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 > rake aborted! > Command failed with status (1): [C:/ruby/bin/ruby > -I"C:/ruby/lib/ruby/gems/...] > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby' > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:126:in > `define' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose' > C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:105:in > `define' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' > C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' > C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 > -e:3:in `load' > -e:3 > > > > David Chelimsky-2 wrote: > > > > On 3/6/07, johnnybutler7 wrote: > >> > >> Hi, > >> > >> i have got RSpec to work on my machine now. I created a new app and > >> followed the instructions again. If i navigate to the spec folder int he > >> rails directory and type spec user_spec.rb then this works fine. If i > >> try > >> the rake command > >> > >> rake spec:models > > > > This rake task assumes model specs are in spec/models. Is user_spec.rb > > at spec/models/user_spec.rb? > > > >> > >> first of all i get the "gem install win32console", so if i remove the > >> --colour from the options i get the error i posted above. Its basically > >> saying it cannot find the spec files. Do i need to set the path > >> somehwere > >> so when i do a rake spec:models it knows where to find them? > >> > >> John B > >> > >> > >> > >> > >> David Chelimsky-2 wrote: > >> > > >> > On 3/6/07, johnnybutler7 wrote: > >> >> > >> >> Hi, > >> >> > >> >> Hi I am trying to use RSPEC on windows and i keep getting the > >> following > >> >> error > >> >> > >> >> "You must gem install win32console to use colour on Windows" > >> >> > >> >> I have installed this Gem but i am still getting the same error. The > >> >> file that error is coming from is: > >> >> > >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb > >> > > >> > That line reads as follows: > >> > > >> > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ /win32/ > >> > ; rescue LoadError ; raise "You must gem install win32console to use > >> > colour on Windows" ; end > >> > > >> > So it seems odd that your rspec was complaining even after you > >> > installed the plugin. There are people are using rspec on windows w/ > >> > some success, so I'm not convinced the problem is in rspec alone - it > >> > seems to be in rspec in conjunction w/ your particular system. > >> > > >> > Any chance you recently upgraded to Vista? Maybe the environment > >> > variables have changed? > >> > > >> > David > >> > > >> >> > >> >> Do i need to put this line of code in? Where do i put it? > >> >> require 'Win32/Console/ANSI' > >> >> > >> >> Can anyone help me, ive searched the web but cant seem to find a > >> >> solution. > >> >> > >> >> JB > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 > >> >> Sent from the rspec-users mailing list archive at Nabble.com. > >> >> > >> >> _______________________________________________ > >> >> rspec-users mailing list > >> >> rspec-users at rubyforge.org > >> >> http://rubyforge.org/mailman/listinfo/rspec-users > >> >> > >> > _______________________________________________ > >> > rspec-users mailing list > >> > rspec-users at rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/rspec-users > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 > >> Sent from the rspec-users mailing list archive at Nabble.com. > >> > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9334771 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From work at ashleymoran.me.uk Wed Mar 7 03:02:08 2007 From: work at ashleymoran.me.uk (Ashley Moran) Date: Wed, 7 Mar 2007 08:02:08 +0000 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <86924770703020941v6b1ce9c2j185e42d633b3718b@mail.gmail.com> References: <86924770703020941v6b1ce9c2j185e42d633b3718b@mail.gmail.com> Message-ID: <8730CD7F-7CB7-4CDB-9CF9-AB007AD3A7BD@ashleymoran.me.uk> Hey Lugovoi Not tried that yet but I like the look of it. You'd have to stub out ActiveRecord::Base.transaction to make it work (meddling with another API call!!! it's starting to grate on me how often this is necessary) though which will surely break transactional fixtures? It just occured to me that I haven't used transactional fixtures - I got confused why some specs were failing, although a recent post made me suspect my test database was just full of crap, and wrote a method to SQL delete the contents table by table. So I never noticed the fallout from stubbing ActiveRecord::Base.transaction, if there was any. I get the feeling this is something that could be generalised though. I'm just reading the paper Mock Roles, not Objects by four of the ThoughtWorks crew. Apparently jMock supports ordering of methods across mocks. I don't know if this is something that's been considered for RSpec. Thanks Ashley On 2 Mar 2007, at 17:41, Lugovoi Nikolai wrote: > What about such specification? > specify "cow, dog and duck must be saved in the same transaction" do > $log.clear > @connection.stub!(:begin_db_transaction).and_return { > $log.record("BEGIN"); nil } > @connection.stub!(:commit_db_transaction).and_return { > $log.record("COMMIT"); nil } > @cow.stub!(:save!).and_return {$log.record("COW SAVE"); true} > @dog.stub!(:save!).and_return {$log.record("DOG SAVE"); true} > @duck.stub!(:save!).and_return {$log.record("DUCK SAVE"); true} > > @tested_object.exec_method_about_cow_dog_and_duck > > txn_intervals = %w(COW DUCK DOG).collect do |beast| > [ $log.find("BEGIN", :before, "#{beast} SAVE"), > $log.find("COMMIT", :after, "#{beast} SAVE")] > end > > txn_intervals.each do |range| > range[0].should_be kind_of(Time) > range[1].should_be kind_of(Time) > end > txn_intervals.uniq.size.should == 1 > end > > where $log can be something like: > $log = Struct.new(:events, :timestamps).new > def $log.clear > events = [] > timestamps = [] > end > def $log.record(what) > events << what > timestamps << Time.now > end > def $log.find(what, where, start) > # return timestamp of event `what' that is :before or :after > (where) event `start' > end -- Codeweavers Ltd (Registered in England and Wales No. 04092394. VAT registration no. 823826816) Address: Unit 11, Imex Technology Park, ST4 8LJ. Tel: 0870 443 0888 From JohnnyButler7 at gmail.com Wed Mar 7 03:45:46 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Wed, 7 Mar 2007 00:45:46 -0800 (PST) Subject: [rspec-users] Windows rspec "gem install win32console" In-Reply-To: <683a886f0703061033n292c0e21nd8ef31cf44db8c12@mail.gmail.com> References: <9328370.post@talk.nabble.com> <57c63afe0703060519u553a90fv4876d008be5701af@mail.gmail.com> <9333516.post@talk.nabble.com> <57c63afe0703060701pa7acdbam85cd0d2cf0015acf@mail.gmail.com> <9334771.post@talk.nabble.com> <57c63afe0703060843y36b8b0cet37d3aa33835e909c@mail.gmail.com> <683a886f0703061033n292c0e21nd8ef31cf44db8c12@mail.gmail.com> Message-ID: <9348730.post@talk.nabble.com> ok, ive made a bit of progress now. If i open a command window and do a spec spec/models --colour this works correctly and gives me my coloured output. If i use rake and add the coloured to the spec.opts file i still get the "gem install win32console error" Everything else is working fine now, suppose i can do without the colour for the rake tasks but it would be nice. thanks JB Kevin Williams-2 wrote: > > My rails app seems to be broken today (pgsql 8.2 problem), but I ran > the specs successfully yesterday. Rails 1.2.2, rspec 0.8.2, > win32console 1.0.8. > > I'm kind of a power user though. My Start => All Programs menu fills > my entire screen, and I have all the UnxUtils binaries in my path. :-] > > On 3/6/07, David Chelimsky wrote: >> On 3/6/07, johnnybutler7 wrote: >> > >> > Yes, thats why i cant understand why i am getting this error message. >> I >> > used ./script/generate rspec_model User and that created the >> user_spec.rb >> > file in the spec/models folder. >> >> Unfortunately (or fortunately, depending on your view), I don't have a >> winbox w/ everything set up to troubleshoot this. Is there anyone >> else on the list who can chime in who is successfully using >> Spec::Rails 0.8, Rails 1.2.2 on windows? >> >> > >> > This is the full message with --trace >> > >> > (in C:/Documents and Settings/JohnButler/My Documents/Ruby on >> > Rails/eclipse/workspace/Workspace/sports) >> > ** Invoke spec:models (first_time) >> > ** Invoke db:test:prepare (first_time) >> > ** Invoke environment (first_time) >> > ** Execute environment >> > ** Execute db:test:prepare >> > ** Invoke db:test:clone (first_time) >> > ** Invoke db:schema:dump (first_time) >> > ** Invoke environment >> > ** Execute db:schema:dump >> > ** Invoke db:test:purge (first_time) >> > ** Invoke environment >> > ** Execute db:test:purge >> > ** Execute db:test:clone >> > ** Invoke db:schema:load (first_time) >> > ** Invoke environment >> > ** Execute db:schema:load >> > ** Execute spec:models >> > C:/ruby/bin/ruby -I"C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" >> > "C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" >> > "spec/models/user_spec.rb" --options "C:/Documents and >> > Settings/JohnButler/My Documents/Ruby on >> > Rails/eclipse/workspace/Workspace/sports/config/../spec/spec.opts" >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:26:in >> > `run': File or directory not found: (RuntimeError) >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in >> > `each' >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:18:in >> > `run' >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:149:in >> > `parse' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `call' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1218:in `order!' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `catch' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1205:in `order!' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1279:in `permute!' >> > from C:/ruby/lib/ruby/1.8/optparse.rb:1300:in `parse!' >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:185:in >> > `parse' >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/option_parser.rb:18:in >> > `create_context_runner' >> > from >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/runner/command_line.rb:14:in >> > `run' >> > from C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec:4 >> > rake aborted! >> > Command failed with status (1): [C:/ruby/bin/ruby >> > -I"C:/ruby/lib/ruby/gems/...] >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby' >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:126:in >> > `define' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose' >> > >> C:/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/rake/spectask.rb:105:in >> > `define' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' >> > C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each' >> > C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' >> > C:\ruby\lib\ruby\gems\1.8\gems\rake-0.7.1\bin\rake:7 >> > -e:3:in `load' >> > -e:3 >> > >> > >> > >> > David Chelimsky-2 wrote: >> > > >> > > On 3/6/07, johnnybutler7 wrote: >> > >> >> > >> Hi, >> > >> >> > >> i have got RSpec to work on my machine now. I created a new app >> and >> > >> followed the instructions again. If i navigate to the spec folder >> int he >> > >> rails directory and type spec user_spec.rb then this works fine. If >> i >> > >> try >> > >> the rake command >> > >> >> > >> rake spec:models >> > > >> > > This rake task assumes model specs are in spec/models. Is >> user_spec.rb >> > > at spec/models/user_spec.rb? >> > > >> > >> >> > >> first of all i get the "gem install win32console", so if i remove >> the >> > >> --colour from the options i get the error i posted above. Its >> basically >> > >> saying it cannot find the spec files. Do i need to set the path >> > >> somehwere >> > >> so when i do a rake spec:models it knows where to find them? >> > >> >> > >> John B >> > >> >> > >> >> > >> >> > >> >> > >> David Chelimsky-2 wrote: >> > >> > >> > >> > On 3/6/07, johnnybutler7 wrote: >> > >> >> >> > >> >> Hi, >> > >> >> >> > >> >> Hi I am trying to use RSPEC on windows and i keep getting the >> > >> following >> > >> >> error >> > >> >> >> > >> >> "You must gem install win32console to use colour on Windows" >> > >> >> >> > >> >> I have installed this Gem but i am still getting the same error. >> The >> > >> >> file that error is coming from is: >> > >> >> >> > >> >> C:\ruby\lib\ruby\gems\1.8\gems\rspec-0.8.2\lib\spec\runner\formatter\base_text_formatter.rb >> > >> > >> > >> > That line reads as follows: >> > >> > >> > >> > begin ; require 'Win32/Console/ANSI' if @colour && PLATFORM =~ >> /win32/ >> > >> > ; rescue LoadError ; raise "You must gem install win32console to >> use >> > >> > colour on Windows" ; end >> > >> > >> > >> > So it seems odd that your rspec was complaining even after you >> > >> > installed the plugin. There are people are using rspec on windows >> w/ >> > >> > some success, so I'm not convinced the problem is in rspec alone - >> it >> > >> > seems to be in rspec in conjunction w/ your particular system. >> > >> > >> > >> > Any chance you recently upgraded to Vista? Maybe the environment >> > >> > variables have changed? >> > >> > >> > >> > David >> > >> > >> > >> >> >> > >> >> Do i need to put this line of code in? Where do i put it? >> > >> >> require 'Win32/Console/ANSI' >> > >> >> >> > >> >> Can anyone help me, ive searched the web but cant seem to find a >> > >> >> solution. >> > >> >> >> > >> >> JB >> > >> >> -- >> > >> >> View this message in context: >> > >> >> >> > >> >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9328370 >> > >> >> Sent from the rspec-users mailing list archive at Nabble.com. >> > >> >> >> > >> >> _______________________________________________ >> > >> >> rspec-users mailing list >> > >> >> rspec-users at rubyforge.org >> > >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >> >> >> > >> > _______________________________________________ >> > >> > rspec-users mailing list >> > >> > rspec-users at rubyforge.org >> > >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> > >> > >> > >> > >> >> > >> -- >> > >> View this message in context: >> > >> >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9333516 >> > >> Sent from the rspec-users mailing list archive at Nabble.com. >> > >> >> > >> _______________________________________________ >> > >> rspec-users mailing list >> > >> rspec-users at rubyforge.org >> > >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >> >> > > _______________________________________________ >> > > rspec-users mailing list >> > > rspec-users at rubyforge.org >> > > http://rubyforge.org/mailman/listinfo/rspec-users >> > > >> > > >> > >> > -- >> > View this message in context: >> http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9334771 >> > Sent from the rspec-users mailing list archive at Nabble.com. >> > >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-users at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > > -- > Cheers, > > Kevin Williams > http://www.almostserio.us/ > > "Any sufficiently advanced technology is indistinguishable from > Magic." - Arthur C. Clarke > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -- View this message in context: http://www.nabble.com/Windows-rspec-%22gem-install-win32console%22-tf3354239.html#a9348730 Sent from the rspec-users mailing list archive at Nabble.com. From work at ashleymoran.me.uk Wed Mar 7 04:14:50 2007 From: work at ashleymoran.me.uk (Ashley Moran) Date: Wed, 7 Mar 2007 09:14:50 +0000 Subject: [rspec-users] Simulate an enumerable with a mock Message-ID: <0B0958B3-1CA2-49F6-9A25-A99DAEAA4F38@ashleymoran.me.uk> I need to simulate an enumerable class (well, it has one method: each). The code looks something like this OTTOMH: class Processor def initialize(input, output) @input = input; @output = output end def run @input.each do |row| @output << ProcessorEngine.new(row).process end end end This is the best I could come up with: @input = mock("input") class << @input def each [ [:a], [:b] ].each do |value| yield value end end end But that seems like adding behaviour to mocks which is generally recommended against. There is no way to specify that the each method is called. I can't decide if this would be desirable or not. What I did instead was (with the help of a bit more setup) ProcessorEngine.should_receive(:new).with([:a]).and_return #blah ProcessorEngine.should_receive(:new).with([:b]).and_return #blah However, the input class is something we made ourselves, and the each method *is* the interface we defined on it, so I have this nagging feeling I should test that it is called. Any thoughts? Ta Ashley From aslak.hellesoy at gmail.com Wed Mar 7 11:45:23 2007 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Wed, 7 Mar 2007 17:45:23 +0100 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <8730CD7F-7CB7-4CDB-9CF9-AB007AD3A7BD@ashleymoran.me.uk> References: <86924770703020941v6b1ce9c2j185e42d633b3718b@mail.gmail.com> <8730CD7F-7CB7-4CDB-9CF9-AB007AD3A7BD@ashleymoran.me.uk> Message-ID: <8d961d900703070845i11c6417bj7c3cd92dd2e83db3@mail.gmail.com> How is JMock supporting ordering of calls across mocks? I have been using JMock for years and have never seen that feature. On 3/7/07, Ashley Moran wrote: > Hey Lugovoi > > Not tried that yet but I like the look of it. You'd have to stub out > ActiveRecord::Base.transaction to make it work (meddling with another > API call!!! it's starting to grate on me how often this is necessary) > though which will surely break transactional fixtures? It just > occured to me that I haven't used transactional fixtures - I got > confused why some specs were failing, although a recent post made me > suspect my test database was just full of crap, and wrote a method to > SQL delete the contents table by table. So I never noticed the > fallout from stubbing ActiveRecord::Base.transaction, if there was any. > > I get the feeling this is something that could be generalised > though. I'm just reading the paper Mock Roles, not Objects by four > of the ThoughtWorks crew. Apparently jMock supports ordering of > methods across mocks. I don't know if this is something that's been > considered for RSpec. > > Thanks > Ashley > > > > On 2 Mar 2007, at 17:41, Lugovoi Nikolai wrote: > > > What about such specification? > > specify "cow, dog and duck must be saved in the same transaction" do > > $log.clear > > @connection.stub!(:begin_db_transaction).and_return { > > $log.record("BEGIN"); nil } > > @connection.stub!(:commit_db_transaction).and_return { > > $log.record("COMMIT"); nil } > > @cow.stub!(:save!).and_return {$log.record("COW SAVE"); true} > > @dog.stub!(:save!).and_return {$log.record("DOG SAVE"); true} > > @duck.stub!(:save!).and_return {$log.record("DUCK SAVE"); true} > > > > @tested_object.exec_method_about_cow_dog_and_duck > > > > txn_intervals = %w(COW DUCK DOG).collect do |beast| > > [ $log.find("BEGIN", :before, "#{beast} SAVE"), > > $log.find("COMMIT", :after, "#{beast} SAVE")] > > end > > > > txn_intervals.each do |range| > > range[0].should_be kind_of(Time) > > range[1].should_be kind_of(Time) > > end > > txn_intervals.uniq.size.should == 1 > > end > > > > where $log can be something like: > > $log = Struct.new(:events, :timestamps).new > > def $log.clear > > events = [] > > timestamps = [] > > end > > def $log.record(what) > > events << what > > timestamps << Time.now > > end > > def $log.find(what, where, start) > > # return timestamp of event `what' that is :before or :after > > (where) event `start' > > end > > > > -- > > Codeweavers Ltd (Registered in England and Wales No. 04092394. VAT > registration no. 823826816) > Address: Unit 11, Imex Technology Park, ST4 8LJ. Tel: 0870 443 0888 > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From JohnnyButler7 at gmail.com Wed Mar 7 12:48:33 2007 From: JohnnyButler7 at gmail.com (johnnybutler7) Date: Wed, 7 Mar 2007 09:48:33 -0800 (PST) Subject: [rspec-users] RC1, Rails, and problems with multiple options in spec.opts In-Reply-To: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> References: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> Message-ID: <9358217.post@talk.nabble.com> I too have this problem. What is the format for adding options to spec.opts file, i cant seem to find anything on the web. Are spaces include so for instance are any of the below valid?: --drb --colour --drb--colour --drb colour --drb -colour JB Scott Taylor-6 wrote: > > I am having inconsistent output with multiple options in the > spec.opts file. I can, for instance, pass --color or --colour, or, > separately, use --drb. But when combining them I get: > > /opt/local/lib/ruby/1.8/optparse.rb:1381:in `complete': invalid > option: --options --color --drb (OptionParser::InvalidOption) > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `catch' > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `complete' > from /opt/local/lib/ruby/1.8/optparse.rb:1212:in `order!' > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `catch' > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `order!' > from /opt/local/lib/ruby/1.8/optparse.rb:1279:in `permute!' > from /opt/local/lib/ruby/1.8/optparse.rb:1300:in `parse!' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > ... 9 levels... > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/option_parser.rb:13:in > `create_context_runner' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > plugins/rspec/bin/spec:4 > rake aborted! > > Is anyone else having this problem? > > I'm on Mac OS X.4.8, using edge rails, ruby 1.8.5, and RC1 > > Best, > > Scott Taylor > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -- View this message in context: http://www.nabble.com/RC1%2C-Rails%2C-and-problems-with-multiple-options-in-spec.opts-tf3330529.html#a9358217 Sent from the rspec-users mailing list archive at Nabble.com. From dchelimsky at gmail.com Wed Mar 7 13:37:52 2007 From: dchelimsky at gmail.com (David Chelimsky) Date: Wed, 7 Mar 2007 12:37:52 -0600 Subject: [rspec-users] RC1, Rails, and problems with multiple options in spec.opts In-Reply-To: <9358217.post@talk.nabble.com> References: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> <9358217.post@talk.nabble.com> Message-ID: <57c63afe0703071037s1b5ca018m185d4778b888e384@mail.gmail.com> On 3/7/07, johnnybutler7 wrote: > > I too have this problem. What is the format for adding options to spec.opts > file, i cant seem to find anything on the web. Are spaces include so for > instance are any of the below valid?: > > --drb --colour > --drb--colour > --drb colour > --drb -colour Try putting each option on a separate line. That works for me, though --colour won't be reflected in the --drb output. You should be able to, however, use something like this: --drb --format specdoc ... for example. > > > JB > > Scott Taylor-6 wrote: > > > > I am having inconsistent output with multiple options in the > > spec.opts file. I can, for instance, pass --color or --colour, or, > > separately, use --drb. But when combining them I get: > > > > /opt/local/lib/ruby/1.8/optparse.rb:1381:in `complete': invalid > > option: --options --color --drb (OptionParser::InvalidOption) > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `catch' > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `complete' > > from /opt/local/lib/ruby/1.8/optparse.rb:1212:in `order!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `catch' > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `order!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1279:in `permute!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1300:in `parse!' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > ... 9 levels... > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:13:in > > `create_context_runner' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/bin/spec:4 > > rake aborted! > > > > Is anyone else having this problem? > > > > I'm on Mac OS X.4.8, using edge rails, ruby 1.8.5, and RC1 > > > > Best, > > > > Scott Taylor > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/RC1%2C-Rails%2C-and-problems-with-multiple-options-in-spec.opts-tf3330529.html#a9358217 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From coda.hale at gmail.com Wed Mar 7 13:47:33 2007 From: coda.hale at gmail.com (Coda Hale) Date: Wed, 7 Mar 2007 10:47:33 -0800 Subject: [rspec-users] RC1, Rails, and problems with multiple options in spec.opts In-Reply-To: <9358217.post@talk.nabble.com> References: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> <9358217.post@talk.nabble.com> Message-ID: You need to have a single option per line. E.g.: --drb --color --diff On 3/7/07, johnnybutler7 wrote: > > I too have this problem. What is the format for adding options to spec.opts > file, i cant seem to find anything on the web. Are spaces include so for > instance are any of the below valid?: > > --drb --colour > --drb--colour > --drb colour > --drb -colour > > > JB > > Scott Taylor-6 wrote: > > > > I am having inconsistent output with multiple options in the > > spec.opts file. I can, for instance, pass --color or --colour, or, > > separately, use --drb. But when combining them I get: > > > > /opt/local/lib/ruby/1.8/optparse.rb:1381:in `complete': invalid > > option: --options --color --drb (OptionParser::InvalidOption) > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `catch' > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `complete' > > from /opt/local/lib/ruby/1.8/optparse.rb:1212:in `order!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `catch' > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `order!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1279:in `permute!' > > from /opt/local/lib/ruby/1.8/optparse.rb:1300:in `parse!' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > ... 9 levels... > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/option_parser.rb:13:in > > `create_context_runner' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > plugins/rspec/bin/spec:4 > > rake aborted! > > > > Is anyone else having this problem? > > > > I'm on Mac OS X.4.8, using edge rails, ruby 1.8.5, and RC1 > > > > Best, > > > > Scott Taylor > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/RC1%2C-Rails%2C-and-problems-with-multiple-options-in-spec.opts-tf3330529.html#a9358217 > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- Coda Hale http://blog.codahale.com From aslak.hellesoy at gmail.com Wed Mar 7 18:00:11 2007 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Thu, 8 Mar 2007 00:00:11 +0100 Subject: [rspec-users] RC1, Rails, and problems with multiple options in spec.opts In-Reply-To: <57c63afe0703071037s1b5ca018m185d4778b888e384@mail.gmail.com> References: <445101B3-41F9-476B-B613-9BF94A7B0A93@railsnewbie.com> <9358217.post@talk.nabble.com> <57c63afe0703071037s1b5ca018m185d4778b888e384@mail.gmail.com> Message-ID: <8d961d900703071500q1fbcc383he3e7a27a5f17f0b5@mail.gmail.com> No, everything must be on a separate line. On 3/7/07, David Chelimsky wrote: > On 3/7/07, johnnybutler7 wrote: > > > > I too have this problem. What is the format for adding options to > spec.opts > > file, i cant seem to find anything on the web. Are spaces include so for > > instance are any of the below valid?: > > > > --drb --colour > > --drb--colour > > --drb colour > > --drb -colour > > Try putting each option on a separate line. That works for me, though > --colour won't be reflected in the --drb output. You should be able > to, however, use something like this: > > --drb > --format specdoc > > ... for example. > > > > > > > JB > > > > Scott Taylor-6 wrote: > > > > > > I am having inconsistent output with multiple options in the > > > spec.opts file. I can, for instance, pass --color or --colour, or, > > > separately, use --drb. But when combining them I get: > > > > > > /opt/local/lib/ruby/1.8/optparse.rb:1381:in `complete': invalid > > > option: --options --color --drb (OptionParser::InvalidOption) > > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `catch' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1379:in `complete' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1212:in `order!' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `catch' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1205:in `order!' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1279:in `permute!' > > > from /opt/local/lib/ruby/1.8/optparse.rb:1300:in `parse!' > > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > > ... 9 levels... > > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > > plugins/rspec/lib/spec/runner/option_parser.rb:180:in `parse' > > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > > plugins/rspec/lib/spec/runner/option_parser.rb:13:in > > > `create_context_runner' > > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > > plugins/rspec/lib/spec/runner/command_line.rb:12:in `run' > > > from /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/ > > > plugins/rspec/bin/spec:4 > > > rake aborted! > > > > > > Is anyone else having this problem? > > > > > > I'm on Mac OS X.4.8, using edge rails, ruby 1.8.5, and RC1 > > > > > > Best, > > > > > > Scott Taylor > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > > > > -- > > View this message in context: > http://www.nabble.com/RC1%2C-Rails%2C-and-problems-with-multiple-options-in-spec.opts-tf3330529.html#a9358217 > > Sent from the rspec-users mailing list archive at Nabble.com. > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > From work at ashleymoran.me.uk Thu Mar 8 06:17:06 2007 From: work at ashleymoran.me.uk (Ashley Moran) Date: Thu, 8 Mar 2007 11:17:06 +0000 Subject: [rspec-users] Specifying that code is called in a block In-Reply-To: <8d961d900703070845i11c6417bj7c3cd92dd2e83db3@mail.gmail.com> References: <86924770703020941v6b1ce9c2j185e42d633b3718b@mail.gmail.com> <8730CD7F-7CB7-4CDB-9CF9-AB007AD3A7BD@ashleymoran.me.uk> <8d961d900703070845i11c6417bj7c3cd92dd2e83db3@mail.gmail.com> Message-ID: <92F6FB45-0AEA-4ABE-B4A6-702E44C164C4@a