similar to: Trouble using should_receive

Displaying 20 results from an estimated 3000 matches similar to: "Trouble using should_receive"

2007 Dec 29
5
./script/story command
Below I''ve pasted a ./script/story command I''ve been using for about a week. It has three modes of operation: 1. ./script/story with no arguments will run all *.story files in the story path 2. ./script/story with a path or glob will run the specified stories 3. If input is passed in via STDIN, it runs that text as a story. This opens up story running via a simple interface
2007 Nov 14
4
Interdependency between RSpec files
I run my suite of tests, one test fails. I run that one test file, no tests fail. Something is carrying over between files and I can''t figure out what. I tracked down the problem to the very line it''s occurring on, with printouts before and after every call to make sure I know exactly what is being reached. In this spec I have 0 fixtures/mocks/stubs. The objects in this
2006 Jul 13
1
model navigation problem with foreign key
Hi, I have a table like this in schema.rb create_table "ac_rooms", :force => true do |t| t.column "roomname", :string, :limit => 50, :default => "", :null => false t.column "updated", :float, :default => 0.0, :null => false t.column "lines", :integer, :limit => 8, :default => 0, :null => false
2008 Mar 18
11
"Why not MockEverthing" or why use fixtures for all tests?
Hello fellow RSpec users. Before you all start warming up your flame throwers please let me explain my Subject line. I''ve been working over 4 months on a large Rails project with a few other developers. Test coverage was spotty at best, though they *were* RSpec tests. One of the other developers and I had started adding more tests, mostly controller tests using the methodology
2012 Nov 26
8
why functional test does not get failure?
The test: test "should get new" do get :new, :room_id => @room.name assert_template(:ne) end the template new does not exists but the test does not get failure. Why? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2005 Dec 23
5
Newbie question/help 2 tables, ''sync'' cell values
I have to << search for each problems.room_id=rooms.id and do problems.room_no=rooms.room >> HOW? More details: I have the following tables: - a "rooms" table, with fields (id,room,create...) - a "problems" table with fields (id,room_id,room_no, ...) problem.rb has belongs_to :room validates_associated :room and room.rb has validates_length_of :room,
2007 Nov 07
10
Plain Text Story example
Hey all, Does anyone have an example(s) of the plain text story runner for rails? I have read David''s blog (http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails) about it but I would like to see some examples with all of the step matchers included... I couldn''t find any more examples on google talking about the plain text stories and the example
2007 Nov 30
2
Nested resources and _path methods
Hi guys, I was thinking aboiut this for a while: If I have nested resource routes, for example /building/1/floor/2/ room/ 3 (building has_many floors and so on), I have to call the room_path method like this: room_path @room.floor.building, @room.floor, @room IsnĀ“t there a better way to handle nested routes with foreign keys, or can I have this method overwritten somewhere? Greets Jonas
2008 Dec 19
3
Delete All action
Hi, What is the best way to delete all members of a model? For example I have a tasks model and want to put a link in that will delete all tasks at once. Something like, @tasks = Task.all @tasks.each { |task| task.destroy } Do I need another action for this, and what should the link to it be? cheers, DAZ --~--~---------~--~----~------------~-------~--~----~ You received this message because
2006 Jan 25
11
Executing Ruby code that is inside a string
I would like to put Ruby code inside a string, between <%= %> tags, and have the code inside the tags executed when the string is displayed. Is this possible? -- Posted via http://www.ruby-forum.com/.
2006 Jul 23
8
destroy vs delete
what is the difference between destroy and delete in AR I am not sure what they mean by "Destroys the record with the given id by instantiating the object and calling destroy<http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000866>(all the callbacks are the triggered). If an array of ids is provided, all of them are destroyed." in
2006 Aug 15
1
serialisation
the case: i have two classes: 1) class Contract < ActiveRecord::Base serialize :addons end 2) class Addon < ActiveRecord::Base end Now i do the following in contract_controller: def create @contract = Contract.new(params[:contract]) @contract.user_id = session[:user_id] @contract.customer_id = params[:customer_id] @contract.pending = 1 @contract.addons = Array.new end def update
2007 Aug 17
4
should_receive, used in the wrong place?
What do you guys think of this: if someone calls should_receive outside of an "it" block, it warns you. before(:each) do @foo = Foo.new @foo.should_receive(:monkeys) end would warn you that you''re setting an expectation in the wrong place, and that "stub" is correct when setting up objects. Opinions? courtenay
2008 Jan 13
2
should_receive twice and arguments
Hi all, I have a method calling Klass.create! two times with different arguments (this happens in a class reponsable for reading in a csv file) I want to test those like this: in one test: Klass.should_receive(:create!).with(:name => "foo").once in another: Klass.should_receive(:create!).with(:name => "foo2").once This doesn''t work because the
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi I noticed that if in my code I use the following: Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})") All my objects are properly updated but none of the filters/callbacks are triggered. Is that what''s expected? I have a before_update filter set on the Photo class and it gets totally ignored, I guess the only way to solve this
2008 Mar 08
3
should_receive(:foo).with(any_object)
Hey, I just ran into a situation where I would like to expect a method call with an argument I know and another one, which is a random number. I think mocking up the rand method is somehow ugly so I thought maybe this is the first time where I can take something from Java to Ruby ;) Java''s EasyMock mocking library knows things like "anyObject()" and "anyInteger()" in
2008 Mar 14
2
Multiple should_receive(:render).with
I''m trying to specify that a particular view must render two different partials. My spec looks like: describe AClass do it do template.should_receive(:render).with(:partial => ''foo'', :locals => { ... }) ... end describe ''some conditional case'' do it do template.should_receive(:render).with(:partial =>
2007 Jun 03
3
should_receive.again
Hi, It appears that if I have 2 should_receives in a row, the latest one overrides the previous one(s). If there isn''t one, could we add a way to accumulate them, such as @thing.should_receive(:method).and_return(@value) @thing.should_receive(:method).again.and_return(@value) @thing.should_receive(:method).again.and_return(@value) would be equivalent to
2008 Jun 12
1
how do I mock the Rails Logger with should_receive?
Hey Guys, I''m trying to mock the Rails Logger for the following code: ... rescue TimeoutError => error $logger.error("#{self.name} Timeout for #{path}: #{error}") and return rescue SocketError => error $logger.error("#{self.name} SocketError for #{path}: #{error}") and return rescue StandardError => error
2008 Jun 12
1
Does anyone know how to mock the Rails Logger then set expectations with should_receive?
Hey Guys, I''m trying to mock the Rails Logger for the following code: ... rescue TimeoutError => error $logger.error("#{self.name} Timeout for #{path}: #{error}") and return rescue SocketError => error $logger.error("#{self.name} SocketError for #{path}: #{error}") and return rescue StandardError => error