similar to: Stubs breaking other things

Displaying 20 results from an estimated 7000 matches similar to: "Stubs breaking other things"

2006 Dec 13
4
RSpec and simply_helpful
Hi All I''m having some problems running my view specs when using simply_helpful. I have it semi-working via the following: module SimplyHelpfulHelper def self.included(base) base.send :include, SimplyHelpful::RecordIdentificationHelper base.send :include, SimplyHelpful::RecordTagHelper end end context "The index template" do setup do @shift =
2006 Jan 18
6
Consistent testing with methods that depend on Date.today
Hi everyone I''m building an app in which quite a bit of data is dependant on dates (and times), and I have logic that depends on when ''today'' is. I''m trying to get some better functional tests written, and am unsure of the best way to approach it. The problem is that I want the tests to run against the same data every time, whether I run it on Tuesday or
2005 Mar 06
8
Tutorial about XMLHttpRequest+Rails
Hi All I just finished writing up a tutorial relating my experience developing a system to edit line-items ''in-line'' in my Rails application using XMLHttpRequest. I thought this might be of interest to some readers of this list... Check it out at http://hieraki.goodlad.ca/read/book/1 Thanks! Dave -- Dave Goodlad dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or
2006 Mar 16
6
Unknown image type: VMX
Hi all I am trying to get VMX guests working on my new server here. The machine has a Pentium D 920 on an ASUS P5WD2-E motherboard. I''ve updated the BIOS to the latest 0401, which added the virtualization option. I am running a fresh installation of Gentoo (64-bit). When I try and run ''xm create'' on a vmx config file, I get the following error: Error: Error
2005 Nov 07
2
Font rendering in Firefox after effects
Hi all I''ve started using some of the scriptaculous effects here, and have noticed something weird. Whenever I use one of the effects, it causes many of the fonts on the same page to rendered with a lighter weight (ie: "less bold"). Has anyone else noticed a similar effect in Firefox? I use 1.5b1 on Mac. This seems to be a common bug in moz-based browsers, as Camino does
2006 Oct 04
3
do we need stubbing?
Hey all - The trunk currently supports three types of mocking/stubbing: Mock Objects (created dynamically at runtime) Partial Mocking of methods on existing classes Stubbing of methods on existing objects or classes The main difference between Partial Mocking and Stubbing is that Stubs don''t verify. I''m wondering if we really need the stubbing facility at all, given that we
2005 Mar 06
2
Using url_for in ActionMailer templates
Hi All I am just adding some basic e-mail notices to my Rails app using ActionMailer, and have one small issue. I want to provide a confirmation URL to users who sign up for an account. I can obviously just hardcode the URL and append the confirmation code to it, but I''d much rather be able to use something like: url_for(:controller => ''authentication'', :action
2007 Aug 12
5
stubbing a method that yeilds sequential results
I''ve just found myself stuck trying to rspec something so am hoping someone more knowledgable can help. I have a Connector class which has a class method ''results'' that yields results it get from a network service based on a set of attributes that I pass to it. I am wanting to yield these results from my Intermediate class up to the next
2010 Jul 13
2
[Rspec] Difference between stub and message expectation with any_number_of_times
I''m wondering what''s the difference between stub and message expectation with any_number_of_times, for example: myMock = mock("mymock") myMock.stub!(:is_a?).with(MyClass).and_return(false) and myMock = mock("mymock") myMock.should_receive(:is_a?).with(MyClass).any_number_of_times.and_return(false) because is_a? may not be called at all, it just like a
2006 Oct 23
6
overriding mock expectations
There is one annoyance I''m encountering with the Mock API in rSpec. Overall it works well, as far as dynamic mocks go ;)... but there''s this one thing... It doesn''t allow overriding of expectations. example: m = mock("blah") m.should_receive(:one).any_number_of_times().and_return(1) m.should_receive(:one).and_return(1) The second call to should_receive
2005 Mar 07
2
erb and builder in same view ....
Has anyone tried using erb and builder in the same file? Either .rxml or .rhtml? I''m wanting to do some think like the following: xml.div(''id''=>''menu'') {|xml| link_to "create race", :controller=>"derby", :action=>"new" } Thanks, -- Tom. -- "Nothing will ever be attempted, if all possible objections must
2006 Jan 13
5
Effect together with ...firstChild - can''t get it to work
Hi, I am relatively new to Rails and I can''t get the following to work: what I am trying to do is to make the first item of a list to flash: var item = $(''items'').firstChild; new Effect.Highlight(item); I get the this Javascript error message: this._base has no child (effects.js, line 445) But I am able to do this without any problems: var item =
2007 Jun 21
4
should_receive stubs methods?
Hey, I''m using rspec and rails and have a spec that tests if a before_filter is executed, I also have a spec that tests if a method called by the filter is executed. It appears however that when I should_receive something, it is no longer actually called when I fire the http request. I''m not sure how, or where exactly I should manually fire the filter, either before or after the
2007 Apr 20
7
Stubbing Model.new w/ block?
Ok, I followed the advice of the list and moved more code into my model from my controller. When developing tests for this new code, I ran into a problem... My model code creates a receipt object and sets some values on it: @receipt = Receipt.new do |r| r.x = 1 r.y = 2 # etc end I wanted to be able to stub out Receipt.new so that I could set expectations on the methods called on the
2007 Aug 06
1
Stubbing Enumerable#each
I have a mock of an instance of a class which descends from Array: class ArrayDescendent < Array; end #... in the specs... @descendent = mock ArrayDescendent How would I stub out ArrayDescendent#each, which is inherited from Array, to return multiple values successively? I could use and_yield, but that is raising an arity error (the anonymous function/ block should expect only *one
2007 Feb 22
9
specking, speccing, or spec''ing
I vote for spec''ing. Anybody else?
2007 Apr 30
4
Mocking with Calculated Results
I am setting up an AR mock object and wanted to sanity check it. My intent is to mix this into all my examples and then override/add methods where necessary. Note that I''ve anticipated three cases for find: find with one numeric argument => object find with :all => Array find with anything else => nil This roughly approximates how ActiveRecord::find works in this case
2006 Nov 10
2
mock syntax order
I have the following statement mock_requester.should_receive(:request_with).with ("x").any_number_of_times.and_return(@object) which works fine, but when i do it backwards, which makes the same amount of sense syntactically, it fails mock_requester.should_receive(:request_with).with("x").and_return (@object).any_number_of_times are all of the mock options
2005 Jul 06
4
Bug in shop demo
http://script.aculo.us/demos/shop if you drag an item from the product list straight to the droppable area to remove an item from the cart, it''ll still add it to the cart. -PJ
2007 Feb 28
12
Specifying that code is called in a block
Not sure if this is possible currently. I have a section of code like this: ActiveRecord::Base.transaction do cow.save! duck.save! dog.save! end (Names changed to protect the innocent.) I''d like to specify that the saves run in a transaction. I can do ActiveRecord::Base.should_receive(:transaction).and_yield But is there any way to specify that the code is