(urgent) How to install shoulda

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

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

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

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.

Thanks Chirag, it works fine now…

Great, happy to help