Re: [rspec-users] Caveman Questions - how to use mock_model in script/console?
On 10/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > On 10/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On 10/5/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Sep 11, 2007, at 2:37 PM, Geoffrey Wiseman wrote: > > > On 9/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > > > irb(main):001:0> require 'rubygems' > > > > => true > > > > irb(main):002:0> require 'spec' > > > > => true > > > > irb(main):003:0> include Spec::Matchers > > > > => Object > > > > irb(main):004:0> 5.should == 5 > > > > => nil > > > > irb(main):005:0> 5.should be < 4 > > > > Spec::Expectations::ExpectationNotMetError: expected < 4, > > > got 5 > > > > > > > > > > $ script/console > > > Loading development environment. > > > >> require 'rubygems' > > > => [] > > > >> require 'spec' > > > NameError: undefined method `failure_message' for class > > > `Spec::Matchers::Have' > > > from > > > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4:in > > > `alias_method' > > > from > > > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4 > > > from > > > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > > > `gem_original_require' > > > > > > > > > David - I haven't seen a follow up to this post. Could you guide me on > > > the > > > right direction? > > > > > > I see that in irb I can include Spec::Mocks::SpecMethods, which allows me > > > mock 'something'. How would I get access to mock_model? > > > > huh? I don't see how the except you quoted relates to mock model > > never mind > > gimme a few Well - I see what the error is coming from. When you say require 'spec' in script/console it's loading up files in vendor/rspec_on_rails before vendor/rspec. In this case, that's causing an alias_method call to choke because there's no method to alias. So the trick is going to be to coerce script/console into loading things in the right order. > > > > > > > > > Scott > > > > > > > > > ___ > > > rspec-users mailing list > > > rspec-users@rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Caveman Questions - how to use mock_model in script/console?
On 10/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > On 10/5/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > > > > > On Sep 11, 2007, at 2:37 PM, Geoffrey Wiseman wrote: > > On 9/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > > irb(main):001:0> require 'rubygems' > > > => true > > > irb(main):002:0> require 'spec' > > > => true > > > irb(main):003:0> include Spec::Matchers > > > => Object > > > irb(main):004:0> 5.should == 5 > > > => nil > > > irb(main):005:0> 5.should be < 4 > > > Spec::Expectations::ExpectationNotMetError: expected < 4, > > got 5 > > > > > > > $ script/console > > Loading development environment. > > >> require 'rubygems' > > => [] > > >> require 'spec' > > NameError: undefined method `failure_message' for class > > `Spec::Matchers::Have' > > from > > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4:in > > `alias_method' > > from > > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4 > > from > > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > > `gem_original_require' > > > > > > David - I haven't seen a follow up to this post. Could you guide me on the > > right direction? > > > > I see that in irb I can include Spec::Mocks::SpecMethods, which allows me > > mock 'something'. How would I get access to mock_model? > > huh? I don't see how the except you quoted relates to mock model never mind gimme a few > > > > > Scott > > > > > > ___ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Caveman Questions - how to use mock_model in script/console?
On 10/5/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > > On Sep 11, 2007, at 2:37 PM, Geoffrey Wiseman wrote: > On 9/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > irb(main):001:0> require 'rubygems' > > => true > > irb(main):002:0> require 'spec' > > => true > > irb(main):003:0> include Spec::Matchers > > => Object > > irb(main):004:0> 5.should == 5 > > => nil > > irb(main):005:0> 5.should be < 4 > > Spec::Expectations::ExpectationNotMetError: expected < 4, > got 5 > > > > $ script/console > Loading development environment. > >> require 'rubygems' > => [] > >> require 'spec' > NameError: undefined method `failure_message' for class > `Spec::Matchers::Have' > from > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4:in > `alias_method' > from > /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4 > from > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > > > David - I haven't seen a follow up to this post. Could you guide me on the > right direction? > > I see that in irb I can include Spec::Mocks::SpecMethods, which allows me > mock 'something'. How would I get access to mock_model? huh? I don't see how the except you quoted relates to mock model > > Scott > > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Caveman Questions - how to use mock_model in script/console?
On Sep 11, 2007, at 2:37 PM, Geoffrey Wiseman wrote: On 9/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'spec' => true irb(main):003:0> include Spec::Matchers => Object irb(main):004:0> 5.should == 5 => nil irb(main):005:0> 5.should be < 4 Spec::Expectations::ExpectationNotMetError: expected < 4, got 5 $ script/console Loading development environment. >> require 'rubygems' => [] >> require 'spec' NameError: undefined method `failure_message' for class `Spec::Matchers::Have' from /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/ spec/matchers/have.rb:4:in `alias_method' from /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/ spec/matchers/have.rb:4 from /usr/local/lib/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require' David - I haven't seen a follow up to this post. Could you guide me on the right direction? I see that in irb I can include Spec::Mocks::SpecMethods, which allows me mock 'something'. How would I get access to mock_model? Scott ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Caveman Questions
On 9/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > irb(main):001:0> require 'rubygems' > => true > irb(main):002:0> require 'spec' > => true > irb(main):003:0> include Spec::Matchers > => Object > irb(main):004:0> 5.should == 5 > => nil > irb(main):005:0> 5.should be < 4 > Spec::Expectations::ExpectationNotMetError: expected < 4, got 5 > $ script/console Loading development environment. >> require 'rubygems' => [] >> require 'spec' NameError: undefined method `failure_message' for class `Spec::Matchers::Have' from /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4:in `alias_method' from /work/workspace/ng/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' -- Geoffrey Wiseman ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Caveman Questions
On 9/5/07, sudara <[EMAIL PROTECTED]> wrote: > > Hello! > > I'm just a caveman with some caveman questions. > > I've been parsing Rspec for quite a while, and I'm writing my first series > of specs. My initial impressions are "Verbose, but understandable. Helpful > and intuitive, but so much to digest." I want to congratulate the folks who > are dedicating a chunk of their lives to writing this, and ask 2 caveman > questions > > My first is "Why lambda in rpsec"? It doesn't strike me as "reads like > english" or "easily understandable." I understand it's place in ruby (um, > kind of :), but my thinking is: > > lambda { do_something_risky }.should raise_error > > would be more understandable (and fun!) written as: > > running { something_risky }.should raise_error That's a great idea. Why don't you add it to the tracker: http://rubyforge.org/tracker/index.php?group_id=797 > > My second question is: For those folks who are getting up to speed with ruby > and rails AND digesting rspec along the way, there is a lot of incoming DSL. > As I started with rails before rspec, I found myself using script/console to > check my code, poking at different ways of expressing myself with ruby. > > Is there a way to "poke at my specs"? I can load up my test environment, but > can I spec things "live" so that I can find out what works and what doesn't? > I find I'm wasting a chunk of time (as I don't have the DSL even 60% down) > writing specs and getting it wrong. Am I missing a trick, or I.should_have > dsl_down_before_trying.else_return(crying)? irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'spec' => true irb(main):003:0> include Spec::Matchers => Object irb(main):004:0> 5.should == 5 => nil irb(main):005:0> 5.should be < 4 Spec::Expectations::ExpectationNotMetError: expected < 4, got 5 Cheers, David > > um, thanks for any potential caveman responses - the more caveman > (pragmatic) the better. > > sudara > > > -- > View this message in context: > http://www.nabble.com/Caveman-Questions-tf4384357.html#a12498949 > Sent from the rspec-users mailing list archive at Nabble.com. > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Caveman Questions
Hello! I'm just a caveman with some caveman questions. I've been parsing Rspec for quite a while, and I'm writing my first series of specs. My initial impressions are "Verbose, but understandable. Helpful and intuitive, but so much to digest." I want to congratulate the folks who are dedicating a chunk of their lives to writing this, and ask 2 caveman questions My first is "Why lambda in rpsec"? It doesn't strike me as "reads like english" or "easily understandable." I understand it's place in ruby (um, kind of :), but my thinking is: lambda { do_something_risky }.should raise_error would be more understandable (and fun!) written as: running { something_risky }.should raise_error My second question is: For those folks who are getting up to speed with ruby and rails AND digesting rspec along the way, there is a lot of incoming DSL. As I started with rails before rspec, I found myself using script/console to check my code, poking at different ways of expressing myself with ruby. Is there a way to "poke at my specs"? I can load up my test environment, but can I spec things "live" so that I can find out what works and what doesn't? I find I'm wasting a chunk of time (as I don't have the DSL even 60% down) writing specs and getting it wrong. Am I missing a trick, or I.should_have dsl_down_before_trying.else_return(crying)? um, thanks for any potential caveman responses - the more caveman (pragmatic) the better. sudara -- View this message in context: http://www.nabble.com/Caveman-Questions-tf4384357.html#a12498949 Sent from the rspec-users mailing list archive at Nabble.com. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users