search for: should_not

Displaying 20 results from an estimated 117 matches for "should_not".

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 rspec_on_rails sources: # respon...
2011 Jul 25
6
What does using a lambda in rspec tests accomplish?
...#39;''', :email => '''', :password => '''', :password_confirmation => '''' } end it "should not create a user" do lambda { post :create, :user => @attr }.should_not change(User, :count) end it "should have the right title" do post :create, :user => @attr response.should have_selector(:title, :content => ''Sign up'') end Comparing the last two tests, it looks to me like: lambda {...
2007 May 19
2
have_text matcher does not support should_not.
Hello Guys, Doing conversion of some test for some controllers, still with integrated views. Anyway, I have this: it "should not see Join This Group button on profile page as member" do get "show", :id => @group.id response.should be_success response.should_not have_text(/Join This Group/) end But running with spec (0.9.4), drop me the folling error: Matcher does not support should_not. See Spec::Matchers for more information about matchers. Which is contradictory, since RDoc state otherwise: http://rspec.rubyforge.org/rdoc-rails/classes/Spec/Rails/...
2007 May 30
9
Specify attr_protected
...question. Question One: I want to be sure that an Order model is protecting sensitive attributes from mass assignment. The example looks like this: describe Order do it "should protect total attribute from mass assignment" do @order = Order.new(:total => 0.05) @order.total.should_not == 0.05 end end And the code to implement it: class Order < ActiveRecord::Base attr_protected :total end It seems to work, but is there a better way? Not saying that this way is bad, just that I''m very green :) Question Two: I actually have a bunch of attributes that need to b...
2008 Jan 19
5
"should_not ==" vs "should !="
describe "should_not == vs. should !=" it do 5.should_not == 6 end # passes it do 5.should != 6 end # fails end # I''m running the rspec 1.1.2 gem with the corresponding Textmate bundle # The second failure surprises me. # Is != not supported? # I''d like to hear what you all thin...
2012 May 24
0
Ruby on Rails Tutorial Chapter 6 RSpec tests failing
...{ should respond_to(:password_digest) } it { should respond_to(:password) } it { should respond_to(:password_confirmation) } it { should respond_to(:authenticate) } it { should be_valid } describe "when name is not present" do before { @user.name = " " } it { should_not be_valid } end describe "when email is not present" do before { @user.email = " " } it { should_not be_valid } end describe "when name is longer than 50 characters" do before { @user.name = "a" * 51 } it { should_not be_valid } end...
2007 Nov 01
3
autotest debugger?
Hi, I keep facing problems with autotest, and I don''t know what''s happening in the background, is there anyway to know what''s happening while testing? Example: @user = User.new @user.email = "testcom" @user.errors.on(:email).should_not be_empty ...throws error failure - You have a nil object when you didn''t expect it! - You might have expected an instance of Array. - The error occurred while evaluating nil.empty? ...but when I type this in ./script/console >> @user = User.new => #<User id: nil, email: nil...
2009 Feb 28
7
be_valid (validates_format_of ..., :on => :create)
...this: class User < ActiveRecord::Base ... validates_format_of :email, :with => /.../, :on => :create ... Using following code is not right: it "should ..." do @user = users(:example_user) @user.email = ''invalid_email_format'' @user.save @user.should_not be_valid end Even those code is not right: it "should ... " do @user = users(:example_user) @user.email = ''invalid_email_format'' @user.save @user.should be_valid end Thanks.
2007 Jan 29
3
Bug in should_not_be - What else to use?
Hi! I just stumbled over a possible bug in 0.7.5.1: `1.should_not_be == 1` does not fail. I took a look into the code and figured out, that this is caused by Not.be() using :no_arg instead of :___no_arg. The expected argument of the method be() in Not is passed from should_not_be() with :___no_arg. Not.be() is marked with "Gone for 0.9", so I assume t...
2007 Sep 20
4
alias :calling :lambda
Sprinkling my examples with ''lambda'' has always seemed like a bit of a wart to me. I''ve gotten into the habit of adding ''alias :calling :lambda'' to my spec suites. My examples then look like: calling { Foo }.should raise_error calling { Bar }.should_not raise_error Is there a reason that RSpec core has chosen not to make exception expectations more sugary?
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
2008 Jun 12
2
Use of ''should'' in another thread
...tried to find anything about using ''should'' within a Thread, but it is a little hard do look up there, so I hope you forgive-me if I am asking an "old question". I guess this spec should fail: describe Thread do it "must be fine" do Thread.new { true.should_not be_true } # Why don''t fail?! end end It seems that some parts of RSpec are not thread safe. Right? Thanks
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 lik...
2007 Jul 29
6
Isolating rails model specs from their implementation
I''m currently taking a Rails project management app I built when learning Rails and adding specs to it. During the course of building the app the requirement that project should be archiveable was added. So a project is in one of two states active or archived. This led to the creation of the following methods: Project.active_projects Project.archived_projects @project.active?
2009 Jan 16
3
rspec model testing - test on user defined validation- How do I test that the create failed.
I''m new to rspec and looking for way to test a validation I added to a model. The test checks to see that if field1 has a value then field2 must be nil and vice versa. ------------------------------- When I did the rspec_scaffold it generated one test which worked before :each do @valid_attributes = { :field1 = "value for field1" :field2 = "value for
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
...he same book" do clip = clips( :some_clip ) book = books( :some_book ) lambda do clipping = Clipping.create( :clip => clip, :book => book ) end.should change( Clipping, :count ).by( 1 ) lambda do clipping = Clipping.create( :clip => clip, :book => ) clipping.should_not be_valid end.should_not change( Clipping, :count ) end Any hints as to how to do this without using fixtures? Cheers Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070724/d3118a91/attachment-0001.h...
2008 Nov 04
9
RSpec and PostgreSQL not playing nicely together
...le.dirname(__FILE__) + ''/../spec_helper'') describe 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 produc...
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 May 01
2
Problem validating boolean
...ment.linked_to_residual_value_of_asset = true @finance_agreement.should be_valid @finance_agreement.linked_to_residual_value_of_asset = false @finance_agreement.should be_valid @finance_agreement.linked_to_residual_value_of_asset = 1 @finance_agreement.should_not be_valid end end end The first two expectations (true and false should be valid values) pass but it fails on this error: should be invalid if linked_to_residual_value_of_asset is not true or false expected valid? to return false, got true /Users/ashleymoran/Documents/...
2008 Oct 09
3
should !=
I expected ''should !='' to act the same as ''should_not ==''. That turned out to be incorrect (by design?): require ''spec'' require ''spec/rails'' describe "using ''should !=''" do it "seems to treat != as the same as ==" do 1.should != 1 # passes 1.should != 2 # fa...