search for: be_nil

Displaying 20 results from an estimated 31 matches for "be_nil".

2007 Dec 30
6
Restful-Authentication Rspec Failure Rails 2.0.2
I am trying the Restful-Authentication (latest version, downloaded today) and upon running the generator, doing the migration, prepping the test system and putting the resources in routes.rb I get a Rspec test failure: ''SessionsController logins and redirects'' FAILED expected not nil, got nil routes.rb has: map.resources :users map.resources :sessions nothing else was
2007 Aug 10
1
How to spec a model method
Still new to Specs... How do I create a spec to test a model method? Specifically, here is my spec: #testing model describe User do it "should have many user roles" do User.reflect_on_association(:user_roles).should_not be_nil end it "should have many roles though user roles" do User.reflect_on_association(:roles).should_not be_nil end it "should know what role it has" do #User.should end end The last spec is incomplete... basically, I will want the code to be something like this:...
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
...------------------------------------------------------------------------- 11:41 /c/work/quizmaker_demo (questions)$ spec spec ...................................c:/work/quizmaker_demo/spec/models/ user_spec.rb:86 User.authenticate(''nonexisting'', ''secret'').should be_nil (rdb:1) s c:/tools/ruby/ruby186/lib/ruby/gems/1.8/gems/mocha-0.9.5/lib/mocha/ class_method.rb:40 stubbee.__metaclass__.class_eval("def #{method}(*args, &block); mocha.method_missing(:#{method}, *a (rdb:1) c
2008 Nov 04
18
Can I do foo.should (be_nil || be_empty) in rspec
Is there any way to do foo.should (be_nil || be_empty) in rspec. Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081104/ee43c9c9/attachment.html>
2007 May 27
12
Checking for Range
how would you check for a range using rspec? person.password.range.should == Range.new(5..40) <- this doesn''t work -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/4d8cb007/attachment-0001.html
2007 Jul 24
6
Mocking Access Control
...dex") should_be_logged_in end it "should logout" do get :logout response.should redirect_to(:controller => "users", :action => "login") should_not_be_logged_in end protected def should_be_logged_in response.session.should_not be_nil session[:user].should_not be_nil end def should_not_be_logged_in response.session.should_not be_nil session[:user].should be_nil end end Unfortunately, the actual method its testing works fine, but my test is getting the following error: "expected redirect to {:action=>...
2007 Oct 06
4
NO NAME (Because of --dry-run) output
I''m just getting started with rspec, I''m running on edge for both. In a fresh project, I freeze edge, install the edge rspec plugin. I generate a simple rspec_model and run the spec. It passes. When I run rake spec:doc, I get the following output: - NO NAME (Because of --dry-run) where the specification should be. In fact if I just make a pending spec, it does the same.
2007 Jul 26
6
response.should_not redirect_to
Hey, May be it is just too deep night over here and I''m missing something though I got this failure on {{{response.should_not redirect_to}}}: ''QueuesController should allow authenticated user to access ''show'''' FAILED Matcher does not support should_not. See Spec::Matchers for more information about matchers. Also I''ve found this in
2007 Sep 18
2
FW: Specifying spec and output format inline?
...(:all) do @browser = Watir::IE.new @browser.goto "http://localhost:8080/admin_frnPkg_add.html <http://localhost:8080/admin_frnPkg_add.html> " end #begin ## Basic page validation it "should have the logo" do @browser.image(:src, /cp_logo.gif/).should_not be_nil end #logo it "should have login/logout text" do login = @browser.table(:index, 1)[2][1].text login.should =~ (/Log/) end #login/logout after(:all) do @browser.close end #after end #Project name -------------- next part -------------- An HTML attachment was scrubb...
2009 Mar 23
3
Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?
...pcode screencast suggests that model.should have(1).error_on(:attribute) should pass if model.send(:attribute) returns nil For me, I get an exception from the rspec script. My work-around is simple. Instead of: - model.should have(1).error_on(:attribute) I Use: -model.send(:attribute).should be_nil But now I have the question: - What kind of error causes: - model.should have(1).error_on(:attribute) - to pass ?? --b
2011 Apr 19
1
RSpec/Webrat Checking output is properly escaped
...:content => "<h1>Oh Hai!</h1><script>", :user_id => @user.id, :format => ''js'' # get json response json = JSON.parse(response.body) json[''html''].should_not be_nil json[''html''].should contain("#{h(''<h1>Oh Hai!</h1><script>'')}") end How would I go about testing this properly? This is the error showing what webrat expected versus what it received: expected the following element...
2008 Mar 10
10
tutes on testing controllers
hello spec''ers, i''m in the hunt for guides on testing controllers with rspec, would you guys recommend any? thanks Oliver -- Oliver Azevedo Barnes oli.azevedo.barnes at gmail.com +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes
2008 Nov 04
9
RSpec and PostgreSQL not playing nicely together
...cribe Product, "The Product model" do describe "When a new blank product object gets created" do before(:each) do @product = Product.new end it "should not be valid" do @product.should_not be_valid @product.errors.on(:title).should_not be_nil # plenty other errors to display... end end end -- And here is the error message when I run this spec: -- spec product_spec.rb F 1) ActiveRecord::StatementInvalid in ''Product The Product model When a new blank product object gets created should not be valid'' PGError:...
2008 Jun 20
15
before_save model callback rspec testing
hi all, i''m learning rspec and i can''t figure out how to test if a callback is executed in a model. my model code is: class User < ActiveRecord::Base before_save :encrypt_password ... def encrypt(password) self.class.encrypt(password, salt) end thanks a lot, cs. -- Posted via http://www.ruby-forum.com/.
2007 Nov 26
8
Renaming RailsExample to RailsExampleGroup
Fyi, I made the following renames: * RailsExample -> RailsExampleGroup * FunctionalExample -> FunctionalExampleGroup * ControllerExample -> ControllerExampleGroup * ViewExample -> ViewExampleGroup * HelperExample -> HelperExampleGroup * ModelExample -> ModelExampleGroup This was done to keep the naming consistent with ExampleGroup.
2008 Jul 11
4
how to debug using rspec stories
...pp So I implemented my story and some of the steps are: (...) When "user creates a product" do post "products/new", :name => @name end Then "there should be a product named ''$name''" do |name| Product.find_by_name(name).should_not be_nil end When I run the story i get: (...) When user creates a product Then there should be a product named ''Book'' (PENDING) 1 scenarios: 0 succeeded, 0 failed, 1 pending Pending Steps: 1) Creating a product (success): there should be a product named ''Book''...
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi, I''m a bit stuck with mocking a unit test of a join model with regards to a validates_uniqueness_of clause. I have class Book < AR:B has_many :clippings various validates_presence_of etc end class Clip < AR:B has_many :clippings various validates_presence_of etc end class Clipping < AR:B belongs_to :book belongs_to :clip validates_uniqueness_of :clip_id,
2008 Mar 01
5
rspec with continuations: very strange
I appear to have written code which travels backwards through time: http://www.vimeo.com/742590 This disturbs me immensely. If anyone can explain it, that would be cool. I think it''s an illusion brought about by how RSpec wraps the code it executes, and by the sheer weirdness of continuations. -- Giles Bowkett Blog: http://gilesbowkett.blogspot.com Portfolio:
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
...our custom magic columns ... end @my_mage = Magik.new @my_mage.save! end it "should set each custom magic column present" do (Magik.column_names & ActiveRecord::Base::HLL_AUDIT_COLUMNS).each do |magic_column| @my_mage.read_attribute(magic_column).should_not be_nil end end I can simply create duplicate separate specification file and set the configuration value appropriately in each. Something along the lines of: describe "Builds a Model with custom magic columns" do before(:all) do config.active_record.default_timezone = nil or co...
2007 Sep 17
0
Specifying spec and output format inline?
...(:all) do @browser = Watir::IE.new @browser.goto "http://localhost:8080/admin_frnPkg_add.html <http://localhost:8080/admin_frnPkg_add.html> " end #begin ## Basic page validation it "should have the logo" do @browser.image(:src, /cp_logo.gif/).should_not be_nil end #logo it "should have login/logout text" do login = @browser.table(:index, 1)[2][1].text login.should =~ (/Log/) end #login/logout after(:all) do @browser.close end #after end #Project name -------------- next part -------------- An HTML attachment was scrubb...