Displaying 20 results from an estimated 2000 matches similar to: "new handling of equality"
2006 Oct 17
0
actual.should != not_expected
All,
In dealing with the changes to should in the
should_be_working_like_ruby branch, I am reminded that while we got
the following to work ...
actual.should_be < value
actual.should_be <= value
actual.should == value
actual.should =~ value
actual.should_be >= value
actual.should_be > value
... we were not able to get this to work:
actual.should != value
Here''s what the
2006 Dec 04
5
should_be_different -- possible implementation
There is an assert_difference helper for Test::Unit (you can read
about it at http://blog.caboo.se/articles/2006/06/13/a-better-
assert_difference and to some it should look familiar -- you know who
you are :), so I took a shot at one for rSpec on Rails.
class Object
def should_be_different(method = nil, difference = nil)
return self.should_not_eql(yield) if method.nil?
2006 Oct 24
2
1 should be 2. huh?
There''s another quirk I wanted to bring up. It''s about the failure
message with should_equal and should_be.
x.should_equal 2
a.should_not_be nil
When they fail they yield messages like:
1 should equal 2
nil should not be nil
When I''m caught off guard, which can be often, these messages confuse
me. 1 should equal 2? No it shouldn''t. nil should not be
2006 Nov 19
2
underscores, sugar, and more and more bugs
I sent this earlier under with the subject "artificial sugar causes
cancer" and I think some spam filters ate it. Here it is again:
======================================
All,
If you look at http://rubyforge.org/tracker/index.php?func=detail&aid=6760&group_id=797&atid=3149
you''ll see that Chad (the submitter) found the source of the bug.
Unfortunately, the source
2006 Nov 19
6
artificial sugar causes cancer
All,
If you look at http://rubyforge.org/tracker/index.php?func=detail&aid=6760&group_id=797&atid=3149
you''ll see that Chad (the submitter) found the source of the bug.
Unfortunately, the source of *this* bug is the *solution* to a
*previous bug* in which Rails was replacing RSpec''s method missing
with its own.
When we settled on underscores, my one reservation was
2006 Oct 16
2
subject.should_be true
As things stand now, the following will all pass:
true.should_be true
"true".should_be true
"false".should_be true
3.should_be true
etc
My feeling is that "should_be true" should only pass if it returns
boolean true even though ruby says that non-nil/non-false is true.
Anybody else?
David
2006 Sep 06
1
support for arbitrary comparisons
Mike Williams contributed a patch to support arbitrary comparisons.
This is now in the trunk and will be part of the next release. So you
will now be able to do this:
result.should_be < 5
result.should_be >= 7
It also supports alternate syntax for should_be, should_match
result.should == 3
result.should =~ /regex/
Personally, I prefer should_be and should_match in these cases, as I
think
2006 Dec 11
1
FAILED: "test" should equal "test" - what?
I''m trying out rspec_on_rails with a very simple test:
...
specify "product name should be ''test''" do
Product.find( :all ).first.name.should_equal ''test''
end
...
with this fixture:
first:
id: 1
name: test
When I run it:
.F
1)
''Given a generated product_spec.rb with fixtures loaded product name should
be
2007 Apr 04
11
ANN: RSpec 0.9.0 beta-1 available for download.
We''d like to get some feedback on RSpec 0.9 before we start pushing
out releases via Rubyforge''s gem server and update the website. We
have therefore made the first beta of 0.9 available - both prepackaged
and tagged in subversion (see below).
RSpec 0.9 introduces a new API for expectations, which essentially
means that your underscores go away (there has been other discussions
2007 Jul 26
5
Coding standards and whitespace
Recently as a result of using Git I''ve noticed a number of
inconsistencies in the RSpec codebase with respect to whitespace
(mixed line endings, mixed use of spaces and tabs for indentation,
and trailing whitespace at the end of lines). I never would have
noticed, but Git produces nice colorized diff output which highlights
these kinds of inconsistencies.
I wanted to ask if the
2006 Oct 11
0
stubbing/mocking
All,
Inspired by a conversation on the mocha list, I added the ability to
mix stubs w/ mocks on the same methods.
Here''s what it allows:
context "a mock" do
specify "can stub! and mock the same message" do
mock = mock("stubbing mock")
mock.stub!(:msg).and_return(:stub_value)
mock.should_receive(:msg).with(:arg).and_return(:mock_value)
2006 Sep 07
0
Dead easy Watir AND Selenium
Yesterday I added some Watir examples to RSpec''s svn.
Today I added some Selenium (actually - Selenium Remote Control) examples.
It''s dead easy to use both, and the Ruby code you end up writing is
actually quite similar. Here''s a taste:
== Watir ==
require File.dirname(__FILE__) + ''/rspec_watir''
context "Google''s search page" do
2007 May 30
2
should_eql etc?
Hi, I''m trying the specs for restful_authentication I found here
http://jonathan.tron.name/articles/2007/01/02/rspec-on-rails-restful-
authentication
It seems to use custom .should methods: should_eql,
should_be_an_instance_of, should_redirect_to, should_be_success,
should_not_be_nil, should_be_nil, should_not_be_nil, should_be_empty,
should_be_success, should_not_change, and
2007 Dec 01
0
mock feed
Hello generous coders,
I''m having difficulty getting a couple of tests to pass.
I have an address model which takes an address and with a callback on save
and update passes the address to google''s
geocoding service. The returned XML is parsed and saved to the address
object:
protected
def geocode_address
key = "mykey"
url =
2007 May 15
3
NOOB question RSPEC
Hi all !!
I have this code:
require ''account''
describe Account, "when first created" do
before do
@account = Account.new
end
it "should have a balance of $0" do
@account.balance.should eql(Money.new(0, :dollars))
end
after do
@account = nil
end
end
How can I pass the @account.balance.should eql(Money.new(0, :dollars))
spec. From my
2007 Apr 08
2
typos in a tutorial page
This page has some typos in the forth grey box
http://rspec.rubyforge.org/tutorials/stack_04.html
"should_equal" should be "should =="
and
"should_not_be_empty" should be "should_not be_empty"
this causes some spec to fail
By the way, this is my first mail to the list, so Hi everybody !!
2008 Mar 05
7
mocking successive return values
I''m having a problems mocking successive return values. I don''t know
if I''m doing something wrong or if this is a limitation of rspec
mocks. Any ideas of what I may be doing wrong?
I''m trying to test the generate_quote_number method. It generates a
quote number, looks to see if it is in the db already. If it is, it
calls itself to try again. I want
2011 Apr 06
2
XCP - license expiry problem - http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1756 not fixed?
Hello,
i have 3 XCP 1.0.0 hosts in a pool, one of them is not enabled:
xe host-param-list uuid=402f07f4-99c0-4501-9787-8dee8984e313
uuid ( RO) :
402f07f4-99c0-4501-9787-8dee8984e313
name-label ( RW): xcp1.domain.com
name-description ( RW): Default install of XenServer
allowed-operations (SRO):
2006 Dec 13
3
Testing has_many :through
I''m working with a has_many :through association, where a Member
has_many Projects through ProjectViewers. The problem I''m running
into is that Rails doesn''t load the association so line (3) fails
until I explicitly access a member of the collection (in this case, I
iterated it). Is there a better way?
Thanks,
Steve
1. assigns[:member].should_not_be_nil
2.
2007 Dec 03
5
spec for model_id should eql
Hello,
I''m confused why the spec described below is failing. Other simple
comparison specs are passing fine for the same model. The code is working
accordingly when I test it through the console, I''m just having difficulty
getting this spec to work. Any pointers would be appreciated.
Failure message:
''Address fetch and geocode should extract department and write to