(urgent) How to install shoulda

26 views
Skip to first unread message

Yennie

unread,
Jun 29, 2011, 11:11:56 PM6/29/11
to Ruby on Rails: Talk
Hi,

I have trouble about install Shoulda, can someone give me some
instruction to install it
I try some .. it ask me to add those code

Rails::Initializer.run do |config|
config.gem "shoulda", :lib => "shoulda"
end

then i cannot do rake to test units.
it gives me error of

/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/
application.rb:63:in `inherited': You cannot have more than one
Rails::Application (RuntimeError)
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/
deprecation.rb:7:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/
deprecation.rb:7:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/
deprecation.rb:7:in `run'
from /home/joanne/Desktop/2/config/environment.rb:7:in `<top
(required)>'
from /home/joanne/Desktop/2/test/test_helper.rb:2:in `require'
from /home/joanne/Desktop/2/test/test_helper.rb:2:in `<top
(required)>'
from test/functional/languages_controller_test.rb:1:in `require'
from test/functional/languages_controller_test.rb:1:in `<top
(required)>'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `load'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `block
in <main>'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `each'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `<main>'
Errors running test:units, test:functionals!

thanks for help

Chirag Singhal

unread,
Jun 30, 2011, 12:09:24 AM6/30/11
to rubyonra...@googlegroups.com
Looks like you are using Rails 3.
In that case, you should be specifying the gem dependency in your Gemfile.

Remove the lines you have added to your environment.rb or application.rb file and the following to your Gemfile

gem 'shoulda'

or better still, define it as a test environment dependency only, by adding this to your Gemfile:

group :test do
  gem 'shoulda'
end

Yennie

unread,
Jun 30, 2011, 12:26:02 AM6/30/11
to rubyonra...@googlegroups.com
Yes, I am using Rails 3.
I did successfully install the shoulda. thank you so much.

but i got some error
 "17) Error:
test_should_get_update(UsersControllerTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: cultures: DELETE FROM "cultures" WHERE 1=1
"

but I did delete the model called culture.. and change it with deterrent name.. may u give me some advice


Chirag Singhal

unread,
Jun 30, 2011, 12:58:00 AM6/30/11
to rubyonra...@googlegroups.com
Make sure that all references to culture model are removed.

You can use rails destroy model culture

If that still doesn't solve the issue, then please post your test here along with the controller and the model used in the test.

Yennie

unread,
Jun 30, 2011, 1:31:58 AM6/30/11
to rubyonra...@googlegroups.com
Thanks Chirag, it works fine now.. 



Chirag Singhal

unread,
Jun 30, 2011, 2:33:01 AM6/30/11
to rubyonra...@googlegroups.com
Great, happy to help
Reply all
Reply to author
Forward
0 new messages