search for: should_be

Displaying 20 results from an estimated 28 matches for "should_be".

Did you mean: should've
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 Nov 19
6
artificial sugar causes cancer
...bject itself, though bloated w/ methods, would not be bloated w/ implementation. This would also give us a single expectations module that we add to Object, providing several benefits including: # more clarity in the API # a place to put meaningful rdoc # a potential formal plugin point 2. Change should_be to ONLY handle arbitrary predicates (not serve as an alias for should_equal): subject.should_be :empty => passes if subject.empty? subject.should_be :instance_of, SomeClass => passes if subject.instance_of? SomeClass etc... In my opinion (feel free to disagree), this actually makes these ex...
2006 Nov 19
2
underscores, sugar, and more and more bugs
...bject itself, though bloated w/ methods, would not be bloated w/ implementation. This would also give us a single expectations module that we add to Object, providing several benefits including: # more clarity in the API # a place to put meaningful rdoc # a potential formal plugin point 2. Change should_be to ONLY handle arbitrary predicates (not serve as an alias for should_equal): subject.should_be :empty => passes if subject.empty? subject.should_be :instance_of, SomeClass => passes if subject.instance_of? SomeClass etc... In my opinion (feel free to disagree), this actually makes these ex...
2006 Dec 13
3
Testing has_many :through
...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. assigns[:member].projects.each{|p| puts "project #{p.name}"} # force association to be loaded 3. assigns[:member].projects.size.should_be 1
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 they read better. Anyone else have opinions about that? This patch also supports u...
2006 Oct 17
0
new handling of equality
All, Based mostly on the earlier thread on "should_be", we have introduced a new branch called should_be_working_like_ruby with the new proposed handling for equality. Per the CHANGES file in that branch (rev 896): ============================================ IMPORTANT NOTE: THIS RELEASE IS NOT 100% BACKWARDS COMPATIBLE TO 0.6.x This release c...
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.sho...
2006 Sep 07
0
Dead easy Watir AND Selenium
....goto(''http://www.google.com'') end specify "should find rspec''s home page" do @browser.text_field(:name, "q").set("rspec") @browser.button(:name, "btnG").click @browser.contains_text("rspec.rubyforge.org").should_be(true) end specify "should not find Ali G when I search for rspec" do @browser.text_field(:name, "q").set("rspec") @browser.button(:name, "btnG").click @browser.contains_text("Ali G").should_be(false) end end == Selenium == requi...
2007 Apr 09
10
changes in 0.8 and greater - should_
Has the should_... syntax changed? I''m getting errors when running the following: should_render(:index) should_be_valid should_not_be_valid should_respond_to should_be should_render I thought the syntax changed to something like the following: obj.should render(:index) but this doesn''t seem to work. Scott
2007 Mar 14
5
What''s the new syntax for predicates?
@settings.should allow_publish_ip("127.0.0.1") fails with undefined method `allow_publish_ip'' for #<#<Class:0x2f8fd48>:0x2f5a968> @settings.should_allow_publish_ip("127.0.0.1") works fine This is rspec 0.8.2. http://rspec.rubyforge.org/documentation/expectations.html says that matching arbitrary predicates is deprecated and to see
2008 Aug 20
9
I want RSpec for CSS layout.
I don''t even know how it''d be possible (through Selenium?), but I want it. I want to see if my stupid CSS hacks break. I want to say: describe "#nav-column" do body = something("#body-column") it "should line up at the top" do dom[:top].should_be == body.dom[:top] end it "should always be to the right" do dom[:left].should_be > body.dom[:right] end end And I want to be able to run it on Firefox, IE6, IE7, and Safari. Lazyweb... go.
2007 Feb 28
12
Specifying that code is called in a block
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
2006 Dec 31
2
what''s with the response.should_be_xxxx stacktrace?
If I do get :index response.should_be_success I get about 20k of marshalled dumpage that starts like #<ActionController::TestResponse:0x390443c @body=\"<html><body>You are being <a href=\"http://test.host/carts/1\">redirected</a>.</body></html>\", @assigns=[], @redirected_t...
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 nil? But they are the sa...
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture- driven way of spec-ing or mocking. How the heck to you mock this so the code at line (2) and (4) work right? I''m still struggling with mocks but it seems like this can be done. Forgive the naivety of this question. 1. def change_quantity 2. @line_item = LineItem.find_by_id(params[:id]) 3. unless
2007 May 09
4
UI testing framework? (w/o selenium)
...ions, and am happy to contribute. My company is totally cool with contributing to open source projects if it makes sense. Any thoughts or suggestions? Here is a sketch of what I think I''d like: server "http://localhost:8080" do test ''/'' do page.status.should_be "200" page.should_have :image, "logo.gif" page.should_have :string, "Copyright 2006-Present SomeCo, Inc. All rights reserved." page.should_have :div, :id => ''copyright'' page.should_include :css, ''default.css''...
2007 Apr 11
10
DRYer controller specs
...specify "should create a new person on GET to create" do Person.should_receive(:new).and_return(@person) get ''create'' end specify "should assign new person to template on GET to create" do get ''create'' assigns[:person].should_be @person end with expect_that_it "should create a new person on GET to create" do Person.should_receive(:new).and_return(@person) end then_it "should assign new person to template on GET to create" do assigns[:person].should_be @person end The problem is tha...
2006 Nov 21
6
Spec Naming (was: Rspec Brown Bag)
...re confidently without it -- the spec doc says, "this is the way things are" rather than "this is kinda sorta maybe how the system works (if there are no bugs)". context "A user purchasing items" do specify "creates an order" do @user.complete_purchase.should_be_instance_of Order end # ... end It''s just a matter of taste in the end, I suppose, but is there a recommended practice for naming specs? Cheers, /Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachment...
2007 Feb 04
10
Spec''ing ActionMailer
...as a side-effect, sends an email to an administrator. I want it to do something like this: specify "when someone successfully signs up, an email should be sent to the administrator with the person''s contact page" do post :signup, {...lots o'' params} response should_be success # here''s where I want to see whether email was sent. Of course, the code is bogus. email.body.should have_tag(:p, :content => /page=/) end Is there some way to reach in and grab the message (what I''ve written as "email" above) so I can test the var...
2006 Oct 15
2
*what* to test?
So I dig rspec and BDD, of course. I thought that Dave''s Google Video was a great intro () -- even if it was a bit heavy on theory and a bit loose on the nuts and bolts. But I don''t see anyone sufficiently answering the big question: What do you test? How do you define higher level and lower level behaviors that should have tests written for them?