Displaying 5 results from an estimated 5 matches for "default_attribut".
Did you mean:
default_attributes
2008 Mar 17
4
RSpec''ing model association callbacks
...ry.create_user()
comment_1 = Factory.create_comment(:author =>
user)
comment_2 = Factory.create_comment(:author =>
user)
user.destroy
comment_1.should be nil
comment_2.should be nil
end
end
----------------- Factory Module
def self.create_user(attributes = {})
default_attributes = {
:first_name => "Foo",
:second_name => "Bar",
:user_name => "FooBar",
:email => "foo at bar.com"
}
User.create! default_attributes.merge(attributes)
end
def self.create_comment(attributes = {})
default...
2008 Jan 11
5
Missing methods
We have a custom implementation of the Mother Object idea. It''s inside
of a module, basically like this:
module Factory
%w(account friendship person invitation message asset email_address
birth).each do |klass|
eval <<-EOF
def self.create_#{klass}(attributes = {})
default_attributes = valid_#{klass}_attributes
#{klass.camelize}.create! default_attributes.merge(attributes)
end
EOF
end
def valid_message_attributes(options = {})
{
#some message options
}
end
#more valid_x_attributes methods
end
When I require this file in a spec file, Factory.create_person w...
2007 Dec 28
2
Arity?
...:import_dir_path => @import_dir_path,
:import_parent_dir_for_image_dirs =>
@import_parent_dir_for_image_dirs,
:params => params,
:import_request => import_request,
:default_attribution => @default_attribution,
:contributing_user =>
@contributing_user.id })
I know that @worker_type is set correctly because of the log.
And in the log I get:
...
PastPerfect4ImporterWorker started
past_perfect4_importer_worker started
Schedules for worker load...
2006 Mar 24
0
Connecting to SQL server on Mac OS X
...odbc and rb-dbi. I can connect to my SQL Server from tsql, but
ActiveRecord won''t connect, and from in irb I get this error:
irb(main):003:0> dbh = DBI.connect(''dbi:ODBC:MYDSN'',''MYUSER'',''MYPASS'')
NoMethodError: undefined method `default_attributes'' for
#<ODBC::Driver:0x485a24 @attrs={}, @name=nil>
from /opt/local/lib/ruby/vendor_ruby/1.8/dbi/dbi.rb:580:in
`connect''
from /opt/local/lib/ruby/vendor_ruby/1.8/dbi/dbi.rb:384:in
`connect''
from (irb):3
Can anyone help? After 3 ho...
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