search for: jaydonnell

Displaying 12 results from an estimated 12 matches for "jaydonnell".

2008 Jan 31
4
reby-debug and rspec
How do I use the ruby debugger with a specific test (not the whole spec file)? I want to do something like this. $ rdebug spec/models/user_spec.rb -s "should error if not new_record" ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search.
2007 Jan 18
4
problems testing a rails controller
I''m trying to test a rails controller, but my mock isn''t working. Everything looks right to me. Can someone take a look at it and see if I''m missing something obvious http://pastie.caboo.se/33883 Domain.should_receive(:find_domain).once.and_return(domain) That line in the spec is failing but I don''t see why. If I comment out that line the test passes so it is
2008 Jan 28
6
client first, top down, outside in, etc with rails
I''m starting a new project and I want to try writing the client first. I.e. I want to write my ''views'' first and I would like to mock out all the models in such a way that I can run the site and browse it with the mocked out models. Is it easy to use rspec''s mocking for this sort of thing and has anyone done it before? Does anyone know of a tutorial out there
2008 Jan 11
13
Role of stories vs specs, revisited
A couple months ago I asked how stories and specs might impact each other. [1] If you look at Dan North''s example of what''s in a story [2], and you imagine using the spec framework to drive the design, you can probably imagine a significant bit of overlap in the two. Is that a bad thing? I''m not sure. It has made me a bit uncomfortable though, and I''ve
2006 Dec 21
1
need some guidance with a test
This is part of a rails project. The following method is part of the Ams class (a rails model). I''m a bit unsure of the rspec/bdd way of testing this method. def persist_as_domains @current_domains.each do |d| dom = Domain.new dom.domain = d dom.source_id = 1 dom.at = Time.now dom.save end end The following is what came out when I tried to write my test. Notice
2006 Dec 18
4
How to keep mocks consistent?
Hey all, Here''s a question for everyone: how do you keep your mocks and stubs consistent with your real objects? I''m dipping my toes into the RSpec world, and it''s absolutely delightful (running dozens of tests in less than a second is nice as well), but I''m concerned about my ability to keep the mocks in my specs consistent with the behavior of their
2007 Dec 06
43
Mocks? Really?
OK, so i''ve played a bit with mocks and mock_models in controller and view tests and i have a question. Is this statement really correct: "We highly recommend that you exploit the mock framework here rather than providing real model objects in order to keep the view specs isolated from changes to your models." (http://rspec.rubyforge.org/documentation/rails/writing/views.html
2006 Apr 18
0
activerecord and mssql server
I''m trying to use activerecord outside of rails with a legacy mssql database. Reading from the db works, but when I try to save a new object (i.e. insert) I get the following error. DatabaseError: Execute (ActiveRecord::StatementInvalid) OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server Cannot create new connection because in manual or distributed transaction
2006 Mar 08
0
call activerecords private methods
Maybe there is an obvious answer and I''m being dumb, but why does activerecord allow me to call it''s private methods? >> i = Item.find(33) => #<Item:0x2360080 @attributes={ ... output removed >> i.price = ''25'' => "25" >> i.update => 1 >> i.create_or_update => 0 >> i.price = ''26'' =>
2006 Feb 16
2
fixtures outside of rails
Is there an easy way to use fixtures outside of a rails app? I''m using activerecord for a project and would love to use fixtures as well, but I haven''t found any info on doing this. I''m hoping it''s something quick and simple someone can explain to me so I don''t have to dig through the rails source :) -- Posted via http://www.ruby-forum.com/.
2006 Nov 18
0
is the model() method no longer necessary
I''m under the impression that the model() method is deprecated and that all ar models should be loaded automatically. They aren''t getting loaded in some cases. For example, I''m using memcached for my session store and it fails if I put one of my ar instances into a session unless i use the model() method in application.rb for that ar class. Actually it works fine in
2006 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in ActionView::Helpers::TagHelper to do some generalized error handling similar to the way scaffolding puts a red border around fields that fail validation. I''ve created a file lib/rails_patches/tag_helper.rb which contains the following. module ActionView module Helpers module TagHelper alias_method :orig_tag, :tag