testing devise with shoulda and machinist - ruby-on-rails

I´d like to test my app with shoulda and machinist. I use the devise authentification gem.
I get following error:
$ ruby unit/page_test.rb
c:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be rem
oved on or after August 2010. Use #requirement
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Admins (N
ameError)
from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
from c:/Users/Mattherick/Desktop/heimspiel/heimspiel_app/app/controllers/admins_controller.rb:1
from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load'
from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:224:in `depend_on'
... 12 levels...
from ./unit/../test_helper.rb:2
from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from unit/page_test.rb:1
Somebody an idea what´s wrong? If I don´t use devise my tests are okay.
And my second question: Does somebdoy has a good tutorial for increasing different roles in the devise gem? If I generate my own views and add a few attributes to my devise-model, they won´t be save in the database. I read the docu at github, but don´t really checked it.
mattherick

Related

"uninitialized constant ActiveSupport::CoreExtensions" when trying to load workling plugin

I'm using Rails 5.0.1. I want to run a background process, independent of my Rails server. I thought the workling plugin would helhp me out -- https://github.com/ascarter/workling . However, upon adding this Gem to my Gemfile
gem 'workling'
and restarting my server, I get this error
Gem Load Error is: uninitialized constant ActiveSupport::CoreExtensions
Backtrace for gem load error is:
/Users/davea/.rvm/gems/ruby-2.4.0/gems/workling-0.4.9.9/lib/workling.rb:16:in `<class:Hash>'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/workling-0.4.9.9/lib/workling.rb:15:in `<top (required)>'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
/Users/davea/.rvm/gems/ruby-2.4.0#global/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'
/Users/davea/Documents/workspace/myproject/config/application.rb:7:in `<top (required)>'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:156:in `require'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:156:in `require_application_and_environment!'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:77:in `console'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
The last commit in workling repo you posted was on Jun 2008. The one RubyGems is using is from February 2009. Either way, R.I.P and there is no point trying to make it work with Rails 5 app :( I strongly recommend checking younger and actively maintained gems, like sidekiq, resque, delayed_job or many others.

Unable to migrate Ruby gems?

I am pretty new to rails. Trying to rake/migrate to a new server. Here is the error I am getting.
[~/rails_apps/baseforesight/config]# rake db:migrate --trace(in
/home/i****\/rails_apps\/baseforesight)
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing'
/home/iftftv/ruby/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/iftftv/ruby/gems/gems/activesupport-2.3.5/lib/active_support.rb:56
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/iftftv/ruby/gems/gems/rails-2.3.5/lib/tasks/misc.rake:18
/home/iftftv/ruby/gems/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load'
/home/iftftv/ruby/gems/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/iftftv/ruby/gems/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each'
/home/iftftv/ruby/gems/gems/rails-2.3.5/lib/tasks/rails.rb:4
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/iftftv/rails_apps/baseforesight/Rakefile:10
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/li/rake/application.rb:495:in`raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:78:in `load_rakefile'
I need sort of a clue on where to start. Anything will be helpful.
Thank you.
According to this Stack Overflow answer, you need to upgrade Rails to 2.3.11.
This should be a fairly painless upgrade if my one upgrade experience was normal.

What’s wrong with my local Rails environment?

There is a Rails application I started a full year ago. It’s a Rails 2.3 app.
Now, someone else has made remote changes (it’s on Github, sorry, but it’s private). And I have done
sudo gem update
that is, updated all my gems, including Rails (to 3).
Realizing this, I have done
rake:freeze:edge RELEASE=2.3.8
or whatever to make this release use that version of rails, hoping this was the solution.
however, no such luck so far.
I get errors trying to start the server, AND trying to run script/console (though it’s more successful).
Note that this exact application works just fine on EngineYard.
Server:
$ script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 45, col 3: `' (ArgumentError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:902:in `database_configuration'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:437:in `initialize_database'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Users/ajh/Sites/PROJECT_NAME/config/environment.rb:11
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
Console:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in load':ArgumentError: syntax error on line 45, col 3:rai'
And when, in console, I try to use a defined model:
#mm = MyModel.find(:all)
NameError: uninitialized constant MyModel
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in load_missing_constant'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:inconst_missing'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from (irb):1
I just had this error, and the problem turned out to be that I'd used a tab instead of a double-space in the database.yml file. Thought I'd mention it, in case others have the same trouble.
My database.yml had a stray end keyword. Cleaning up that file solved my problems. Thanks to Garrett for pointing me in the right direction!

Upgrading rails / reloadable

I have tried to upgrade my rails in order to deploy a old RoR app into Heroku,
Unfortunately I'm getting some errors and I have no clue how to fix this. It seems that include Reloadable from my model isn't working anymore:
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant Artist::Reloadable (NameError)
from /disk1/home/slugs/123146_6bfd10b_0628/mnt/app/models/artist.rb:2
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:224:in `depend_on'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:136:in `require_dependency'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:414:in `load_application_classes'
... 23 levels...
My previous install was using RAILS_GEM_VERSION = '1.1.2'.
Have you tried deleting the include Reloadable
Reloaded has been deprecated for a long time. Check this out: http://weblog.rubyonrails.org/2006/8/11/reloading-revamped
The functionality you're looking for may now be automatically built into rails.

`load_missing_constant' after installing Typus rails plugin

Getting an odd error. Just installed the Typus rails admin plugin, which is supposed to work in 2.3.2. However, after install it seems to mess with my user model. Not sure where to start here, any ideas?
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Typus::Authentication::ByPassword (NameError)
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
from /Users/apple/Sites/app/app/models/user.rb:10
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_file'
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:379:in `load_file'
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:259:in `require_or_load'
from /Users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:425:in `load_missing_constant'
... 35 levels...
from /Users/apple/.gem/ruby/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems
/custom_require.rb:31:in gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire'
from script/server:3
Are you using restful_authentication?
If so, there's a name conflict between the 'Authentication' module restful_authentication provides and the one included in Typus.
I renamed all the references to restful_authentication's modules from Authentication to RestfulAuthentication, and changed the module name in vendor/plugins/restful_authentication/lib/authentication.rb. Not sure if there's a better way to specify which module the model should use.
Alternatively, you can prefix the Restful Authentications with :: to clear up the discrepancy,
::Authentication instead of Authentication

Resources