search for: be_false

Displaying 7 results from an estimated 7 matches for "be_false".

Did you mean: b_false
2008 May 20
5
How to write a test for validates_uniqueness_of
...I have a code: validates_uniqueness_of :user_name Now, I don''t know how to test this code. In order to test this, do I need to run `save`? For example, @user = User.create(:username => "mike") @another = User.create(:username => "mike") @another.save.should be_false This messes up test database. Is there any better way? -T
2007 Oct 16
6
Failure trying to test ApplicationController
...ntroller do it_should_behave_like ''Application controller'' end describe ''Application controller'', :shared => true do it ''should fail require_login check if not logged in'' do User.current = nil controller.require_login.should be_false response.should redirect_to(:controller => ''account'', :action => ''logon'') end end def require_login return true if User.current.logged_in? redirect_to :controller => "account", :action => "logon" and return fals...
2008 Oct 18
4
Problems when programmatically defining examples
Hi, I am trying to code an application that is based on Rspec; I am programmatically building examples, and launching the runner with a custom formatter. Here are the code snippets from my app: Launching the runner: example_groups = test_expectation.example_groups_for(system_state) @output = StringIO.new options =
2007 Sep 27
1
rspec_on_rails: controller method not getting called
In my rspec_on_rails controlle rspec, I have this: require File.dirname(__FILE__) + ''/../spec_helper'' describe FooController, "with a foo" do it "should be false" do get ''index'' assigns[:foo].should be_false end end In my controller I have this: class FooController < ApplicationController def index @foo = FALSE end end But the result of running the spec is: 1) ''FooController should be false'' FAILED expected false, got nil It seems I can give any argument to `get`in th...
2008 Jun 05
1
Using and_yield to pass multiple or no iterations
...uld it be possible to set it up to test the case when each_row operates on an empty Array? Sort of like this: <SPEC> it "should return false if it does not iterate over anything" do @egg.stub!( each_row ).and_yield( nil ) # I know this doesn''t work @egg.do_thing.should be_false end it "should return true if it does iterate over something" do @egg.stub!( each_row ).and_yield( :value ) @egg.do_thing.should be_true end </SPEC> Secondly, is this the best (correct) way to pass multiple values to iterate over? <SPEC> it "should be doing somethi...
2008 Mar 08
10
rspec groups?
One of the things I really liked about TestNG was the grouping feature. Are there any plans for rSpec to incorporate that? Is there any way to emulate that functionality in rspec? Will.
2012 May 24
0
Ruby on Rails Tutorial Chapter 6 RSpec tests failing
...hould == found_user.authenticate(@user.password) } end describe "with invalid password" do let(:user_for_invalid_password) { found_user.authenticate("invalid") } it { should_not == user_for_invalid_password } specify { user_for_invalid_password.should be_false } end end end ------------------------------------------------- Here is my gemfile: source ''https://rubygems.org'' gem ''rails'', ''3.2.3'' gem ''bootstrap-sass'', ''2.0.0'' gem ''bcrypt-ruby'...