search for: be_tru

Displaying 20 results from an estimated 23 matches for "be_tru".

Did you mean: be_true
2012 Apr 04
5
Simple code dosn't work
I think you have a syntactical error on the line thats throwing the error, you state: > j.even?should be true #throws an error on j == 2, j == 4 should this line not read as: j.even?.should be true -- Posted via http://www.ruby-forum.com/.
2008 Jun 12
2
Use of ''should'' in another thread
...ind 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
2008 Apr 25
0
Spec migrations?
...=> true) m1.save_with_validation(false) m2 = Member.new(:manager => true) m2.save_with_validation(false) m3 = Member.new(:manager => true) m3.save_with_validation(false) `rake db:migrate VERSION=60` Member.find(m1.id).has_role?("manager").should be_true Member.find(m2.id).has_role?("manager").should be_true Member.find(m3.id).has_role?("manager").should be_true end end
2007 Oct 04
7
Using Predicates to look at an array..
Hi all, I have an array of shipping_type''s being returned, and I want to see what is in there. In the past I have done: shipping_type.include?(Cart::SHIPPING_TYPE_REGULAR).should be_true This works, but looks really ugly.. It just doesn''t roll of the tongue very well. I then looked up the use of Predicates, which I had been using, but hadn''t realized: shipping_type.should be_include(Cart::SHIPPING_TYPE_REGULAR) This works, however the syntac of be_i...
2012 Feb 23
2
testing around_save
I''ve just upgraded to Rails 3.2.1 and I can''t get my specs checking whether or not around_save work anymore. I simply did something like: object.should_receive :around_filter_name object.save.should be_true (Actually, it was slightly more complex, it''s part of a state machine)
2012 Sep 15
2
[RSpec Testing] Methods take two arguments
...required)>'' *here is my pdf_helper_spec.rb file: * require ''pdf_helper'' describe "PdfHelper" do it "Should be in public folder" do file = File.new ("#{Rails.root}/public/pdf") File.exist?(file).should be_true end it "Should have two arguments" do file = File.new("#{Rails.root}/public/pdf/templates/chbox.pdf") user = User.create(:first_name => "mark", :last_name => "jhon", :account_number => &qu...
2007 Jul 31
11
helper spec not finding rails core helpers
...now distance_of_time_in_words( t, t + 50.minutes) return true end end # application_helper_spec.rb require File.dirname(__FILE__) + ''/../spec_helper'' describe ApplicationHelper do it "should find app_foo in application_helpers.rb" do app_foo.should be_true end end # error output NoMethodError in ''ApplicationHelper should find app_foo in application_helpers.rb'' undefined method `distance_of_time_in_words'' for [Dynamically generated class for RSpec example]:#<Class:0x32d11c8>
2008 Jun 05
1
Using and_yield to pass multiple or no iterations
...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 something else, too" @egg.stub!( :each_row ). and_yield( :first_value ). and_yield( :second_value ). and_yield( :third_value ) @egg.do_th...
2008 Aug 27
3
array_including()
I found myself having to write this today: class ArrayMatcher def initialize(array_to_match) @array_to_match = array_to_match end def ==(other) ok = true @array_to_match.each do |item| ok = ok and other.include?(item) end ok end end def array_including(array_to_match) ArrayMatcher.new(array_to_match) end Is there already something in the
2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
...xpectations (2.5.0) rspec-mocks (2.5.0) When I try to run this spec: require Pathname(__FILE__).ascend { |d| h=d+''spec_helper.rb''; break h if h.file? } describe B3::Bdd do it "should indicate RVM is installed locally" do B3::Bdd::Helpers.rvm_local_install?.should be_true end end The spec helper is: require ''rspec'' ; require_relative ''../lib/b3'' Which describes this code: class B3 module Bdd module Helpers def rvm_local_install? puts ENV[''rvm_path''] rvm_path = Pathname.new(ENV[...
2007 Sep 04
3
Model Specs: Fixtures vs Mocks + Stubs?
What is the general opinion about fixtures versus mocking and stubbing in model specs? I heard from agile on IRC that they save the database testing for integration testing, but I also see that the caboose sample applicaiton uses fixtures. I also noticed that on the rspec site, it says "Ironically (for the traditional TDD''er) these are the only specs that we feel should actually
2008 Oct 26
0
daylight savings time difference with rspec?
...25, or 30 days. in my example I check an interval because the two events are not simultaneous between when the model calls Time.now and when the rspec example calls it: rhs = expires_on < (Time.now + (n +200)) lhs = expires_on > (Time.now + (n -200)) (rhs && lhs).should be_true I find that if n takes the expires_on across the daylight savings time change then the model and rspec are off by 1 hour. Why is there a difference? Are Rails and RSpec referencing different time objects? Thanks for your help, Harry -- Posted via http://www.ruby-forum.com/.
2007 Apr 13
1
File.should be_exist?
Hi! Is there a nicer way of writing File.should be_exist(''filename'')? File.should exist(''foo'') throws NoMethodError in ''specification'' undefined method `exist'' for #<#<Class:0x3ec1c30>:0x3ebc308> (I''m using rspec from the trunk) Esad
2009 May 19
0
View testing (rspec/selenium) - test if a file link works
...d selenium. The line to click the download link looks like this: @browser.wait_for_then_click "//p[@id=''zip-download'']/a[2]/em" So i guess i''m looking for something along these lines (i have no idea of the right syntax): @browser.element(//file/*.zip).should be_true Any advice welcome! max -- Posted via http://www.ruby-forum.com/.
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.
2008 Dec 16
20
step definitons to check login
I am working with the authlogic gem and trying to create a simple login test from cucumber features. The feature statement is: Given the user is not logged in The step definition for this is confounding me. In the application_controller the authlogic tutorial recommends the following: private def require_user unless current_user store_location flash[:notice] =
2008 Aug 26
9
stub_model() and ActiveRecord Associations
...source_comment = @source.comments.create(:user_id => 1) @target_comment = @target.comments.create(:user_id => 1) end it "should return the same object from create() as from the array" do (@target_comment.equal?(@target.comments[0])).should be_true do_merge end What I actually want to be able to do, is mock a method call on the @target_comment but I''m finding that I get unreliable results: @target.comments[0].should_receive(:merge_in) # works # @target_comment.should_receive(:merge_in) #...
2007 Oct 09
23
Testing layouts with RSpec on Rails
Hey guys, Does anyone have any wisdom to share on the subject of speccing Rails layouts? Most of it''s plain old view specs stuff, but are there sensible ways to verify things like the yield call? (Mocking doesn''t catch that) Thanks, Matt -- Matt Patterson | Design & Code <matt at reprocessed org> | http://www.reprocessed.org/
2008 May 13
6
Testing that named_scope is defined
...d_scope. I''m not actually trying to test its behavior, as it''s not my code, but I wanted to test at least that it''s defined. I tried doing this: describe Post, ".most_recent" do it "should be defined" do Post.method_defined?(:most_recent).should be_true end end But it always fails, even though it *is* defined. Any idea on how to test this? Thanks a lot! Cheers, -- Helder Ribeiro ProFUSION Embedded Systems http://profusion.mobi "If I have not seen as far as others, it is because giants were standing on my shoulders" -- Jeff Goll
2007 Nov 20
2
confirming that a model instance was correctly created from POST params
...:save! ) 32 OrderAccount.stub!( :new ).and_return( order_account ) 33 34 assigns[:use_separate_shipping_address] = FALSE 35 params[:is_business_address] = TRUE 36 create_order_from_post 37 38 assigns[:billing_address].is_business_address.should be_true end end What I am trying to demonstrate to myself is that the addition of a boolean "is_business_address" column to the order_addresses table via a migration allows line 40 of the create_order_from_post method to set this property when an OrderAddress instance is created. But my exam...