search for: should_not_be_nil

Displaying 8 results from an estimated 8 matches for "should_not_be_nil".

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 should_not_be_activated Is this using an old version of rspec, and/or do i need to define these methods and how? thanks linoj
2006 Dec 13
3
Testing has_many :through
...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. assigns[:member].projects.each{|p| puts "project #{p.name}"} # force association to be loaded 3. assigns[:member].projects.size.should_be 1
2007 Feb 01
3
should_redirect_to in rspec-0.8.0 / rspec_on_rails 1453
...hould add a record" do post :edit_or_create, :user => {:login => ''joeschmoe'', :email => ''joe at shmoe.com'', :email_confirmation => ''joe at shmoe.com'', :full_name => ''Joe Schmoe''} assigns[:user].should_not_be_nil assigns[:user].new_record?.should_not_be(true) flash[:notice].should_match(/user added/) response.should_be_redirect puts "redirecting to #{response.redirect_url}" puts "this response was #{response.redirect?}" controller.should_redirect_to '...
2011 Jul 14
1
RoutingError with RSpec Controller test on Scoped Route
...end end And a bunch of controller specs, an example of which looks like this: describe ShopsController do describe "when responding to a GET" do context "#new" do it "should create a new instance of the shop class" do get :new @shop.should_not_be_nil end end end end In rake routes, as well as via a web browser, this controller/action works fine. However, RSpec throws: 1) ShopsController when responding to a GET#new should create a new instance of the shop class Failure/Error: get :new ActionController::RoutingError: No rout...
2007 Apr 26
0
Shouldn't this spec fail?
...lize doesn''t seem to be the right way of doing this, but before_create or any of the other things don''t make the first test pass. specify "should provide a default name when none is given" do @emailer.attributes = valid_emailer_attributes.except(:name) @emailer.name.should_not_be_nil @emailer.should_be_valid end specify "should not replace name if one is given" do @emailer.attributes = valid_emailer_attributes # valid name attribute is "bill" (@emailer.name=="bill").should_be_true end class Emailer < ActiveRecord::Base def after_in...
2006 Dec 30
2
Another RSpec on Rails issue: how to test send_file()
Hi! Today I needed to implement some controller code, that uses send_file() to send image data. How can this be tested / specified with RSpec? bye, Tobias
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 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback. first, .should_have_valid_associations usage: context "A new Product" do specify "should have valid associations" do @product.should_have_valid_associations end end code: (thanks to Wilson/Defiler for converting to rspec) module Spec module Expectations module Should