Re: [rspec-users] stub! and stubs

2009-10-12 Thread David Chelimsky
On Oct 12, 2009, at 10:26 PM, Scott Taylor wrote: On Oct 12, 2009, at 9:14 PM, David Chelimsky wrote: On Oct 12, 2009, at 9:37 PM, Sam Woodard wrote: I have an interesting setup: I am using rspec for mocking but I have mocha installed which give me access to any_instance, expects, etc.

Re: [rspec-users] stub! and stubs

2009-10-12 Thread Scott Taylor
On Oct 12, 2009, at 9:14 PM, David Chelimsky wrote: On Oct 12, 2009, at 9:37 PM, Sam Woodard wrote: I have an interesting setup: I am using rspec for mocking but I have mocha installed which give me access to any_instance, expects, etc. The problem that I am having is that I want to stub

Re: [rspec-users] stub! and stubs

2009-10-12 Thread David Chelimsky
On Oct 12, 2009, at 9:37 PM, Sam Woodard wrote: I have an interesting setup: I am using rspec for mocking but I have mocha installed which give me access to any_instance, expects, etc. The problem that I am having is that I want to stub out a method for the duration of a single example, thr

[rspec-users] stub! and stubs

2009-10-12 Thread Sam Woodard
I have an interesting setup: I am using rspec for mocking but I have mocha installed which give me access to any_instance, expects, etc. The problem that I am having is that I want to stub out a method for the duration of a single example, throughout that example but only for that example. If I

Re: [rspec-users] should and != operator

2009-10-12 Thread Bret Pettichord
Aslak Hellesøy wrote: Den 12. okt. 2009 kl. 21.11 skrev Bret Pettichord : Looks like an rspec bug to me. It's not an rspec bug. != is not a method, and therefore can't be treated by rspec. It's a limitation of ruby. OK. I get it. Bret ___ rspec-u

Re: [rspec-users] should and != operator

2009-10-12 Thread Ashley Moran
On 12 Oct 2009, at 19:33, Willy Mene wrote: it "should fail but passes" do [].should != [] 'some string'.should != 'some string' end This is a common mistake, and one I made for a long while even after being familiar with RSpec. I wonder if there is justification for an AST pass over

Re: [rspec-users] should and != operator

2009-10-12 Thread Tero Tilus
2009-10-12 22:18, Tero Tilus: > Expression x!=y is instead just syntactic sugar for !(x==y). To illustrate how this affects #should, think of 'some string'.should != 'some string' Now Ruby internals kick in and desugar this (before anything is even executed) to !('some string'.should == 'so

Re: [rspec-users] should and != operator

2009-10-12 Thread s.ross
It's not a bug. Consider: "abc".should eql("abc") <= pass "abc".should_not eql("def") <= pass But eql() is a Ruby method. In Pickaxe, you'll see that other comparators such as != >= etc. Are not implemented as overridable methods. Hope this clarifies. Hunted and pecked from my iPhone On

Re: [rspec-users] should and != operator

2009-10-12 Thread Aslak Hellesøy
Den 12. okt. 2009 kl. 21.11 skrev Bret Pettichord : Looks like an rspec bug to me. It's not an rspec bug. != is not a method, and therefore can't be treated by rspec. It's a limitation of ruby. Aslak Bret Willy Mene wrote: I've tried searching around for something describing how the #

Re: [rspec-users] should and != operator

2009-10-12 Thread s.ross
Afaik, != is one of the few operators that is intrinsic. I believe there is no !=() method defined in Ruby. Hunted and pecked from my iPhone On Oct 12, 2009, at 12:21 PM, Willy Mene wrote: Yes, I do know about .should_not, and the example should be written that way. So the following []

Re: [rspec-users] should and != operator

2009-10-12 Thread Bret Pettichord
Looks like an rspec bug to me. Bret Willy Mene wrote: I've tried searching around for something describing how the #should method works with the != operator, but couldn't find anything conclusive. Can someone please explain while the following lines will pass if placed into an rspec example?

Re: [rspec-users] should and != operator

2009-10-12 Thread Tero Tilus
2009-10-12 11:33, Willy Mene: > I've tried searching around for something describing how the #should > method works with the != operator Afaik it doesn't. I have led to believe this is because there is no method '!='. Expression x!=y is instead just syntactic sugar for !(x==y). > it "should f

Re: [rspec-users] should and != operator

2009-10-12 Thread Willy Mene
Yes, I do know about .should_not, and the example should be written that way. So the following [].should_not == [] 'string'.should_not == 'string' do fail. But I'm trying to understand why they pass with .should != Willy On Oct 12, 2009, at 12:08 PM, Lee Hambley wrote: Willy... Should

Re: [rspec-users] should and != operator

2009-10-12 Thread Lee Hambley
Willy... Should you not use .should_not ? -- Lee ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] should and != operator

2009-10-12 Thread Willy Mene
I've tried searching around for something describing how the #should method works with the != operator, but couldn't find anything conclusive. Can someone please explain while the following lines will pass if placed into an rspec example? it "should fail but passes" do [].should != []