`rake spec` fails with no error message - ruby-on-rails

OS X Mavericks
Ruby 1.8.7
Rails 2.3.18
Rspec 1.3.2
Rspec-rails 1.3.4
Output of rake spec
$ rake spec
(in /Users/timosand/Dropbox/Development/epassi)
Please install RDoc 2.4.2+ to generate documentation.
DEPRECATION WARNING: Rake tasks in vendor/plugins/annotate_models/tasks, vendor/plugins/barcode_generator/tasks, vendor/plugins/crypted_authentication/tasks, vendor/plugins/oauth-plugin/tasks, vendor/plugins/tarantula/tasks, and vendor/plugins/ym4r_gm/tasks are deprecated. Use lib/tasks instead. (called from /usr/local/var/rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/rails-2.3.18/lib/tasks/rails.rb:10)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from /usr/local/var/rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/carrierwave-0.4.10/lib/carrierwave.rb:84)
/Users/timosand/Dropbox/Development/epassi/config/initializers/oauth_consumers.rb:7: warning: already initialized constant VERSION
/Users/timosand/Dropbox/Development/epassi/lib/spreadsheet/format.rb:21: warning: already initialized constant COLORS
I have 45 spec files
$ find spec -name '*_spec.rb' | wc -l
45
I've added p __FILE_ to each spec and every filename gets printed. Still the actual tests are not run.
Any advice on how to solve this?
Here is my spec_helper.rb and one controller spec as an example

Related

Bundler::GemRequireError when trying to run a rails app

While trying to run a rails app, I am getting the following error
rails s -p 5000
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant Net::SMTPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: previous definition of SMTPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant Net::POP
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: previous definition of POP was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant Net::POPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: previous definition of POPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant Net::POP3Session
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: previous definition of POP3Session was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant Net::APOPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: previous definition of APOPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'activeadmin'. (Bundler::GemRequireError)
What causes a Gem Require error in bundler?
I hope its trying to load activeadmin
May be the problem in activeadmin
check the gemfile and installation
gem 'activeadmin'
Use this to install activeadmin : Active admin install with Rails 4
It seems like you have multiple versions of the gem tlsmail being installed/loaded. That is the reason, you get the warning of it being already initialized. What you can do is run:
gem list --local | grep 'tlsmail'
which will return a list of versions of the gem installed. Then you can remove one of the versions (as per the dependency of your project) and see if that works.
gem uninstall tlsmail -v <version>
You might also want to check, whether you have same gem with different versions in the Gemfile.
Hope that helps!
Did you initialize your gemset? (Because you're using RVM)
Initialize your gemset as follows before running server,
rvm use ruby-2.3.0#rails425
replace the version of ruby and the name of gemset with your version of ruby and name of gemset.

undefined method `home' for Dir:Class

I follow the shapado install with http://gitorious.org/shapado/shapado/blobs/master/README,
and when I execute rake bootstrap RAILS_ENV=development,it will generate some warnings and errors
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in Mongoid::Criteria instead. (called from include at /usr/lib/ruby/gems/1.8/bundler/gems/mongoid_ext-edcb64748380/lib/mongoid_ext/criteria_ext.rb:15)
rake aborted!
undefined method `home' for Dir:Class
I am a newbie to ror,I am on the ubuntu-server 11.10 platform,so I don't know how resolve it
I solved it:
to get rid of the DEPRECATION WARNING,just comment the code in criteria_ext.rb:15 as its instruction
module InstanceMethods
end
my ubuntu11.10 will first my install 1.8.7,when I execute ruby -v,it will show me that the current ruby version is 1.8.7,so it is sure that Dir.home method is not exist in 1.8.7,so I remove the default ruby in /usr/bin/ruby, then execute rvm --default use 1.9.3-p125
it's not related with the shapado,it's only the ruby version of my mistaken

rake db:create the error

give me solution for this
when i'm running rake db:create
it is showing warning like these
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <class:Engine> at /home/shajin/.rvm/gems/ruby-1.9.2-p0/bundler/gems/spree_paypal_express-073f2f814dd8/lib/spree_paypal_express.rb:5)
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Soletronspree::Application#task called at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/deface-0.5.2a/tasks/deface.rake:3:in `block in <top (required)>'
soletronspree_test already exists
soletronspree_development already exists
First of all try updating your gems, specifically spree_paypal_express.
bundle update
It is currently locked at 073f2f814dd8... and according to GitHub that SHA1 hash points to a 6 months old commit.
If you are currently not using the latest from the git repository, try them out by changing the gem line to this:
gem "spree_paypal_express", :git => "git://github.com/spree/spree_paypal_express.git"
The latest paypal extension release depends on Spree 1.0.0 or later. To install 1.0.0 change your current spree gem line to this:
gem 'spree', '1.0.0'
and run bundle update
Keep in mind, that updating Spree may break previous functionality elsewhere.
But it's always a great idea to stay up-to-date to have all the newest features.

Get and install a new RDoc template

I am using Ruby on Rails 3.0.7 and I would like to install and use a new RDoc template (instead of the default) in order to documenting my application.
I would like to choose one of following:
http://api.rubyonrails.org/
http://www.ruby-doc.org/core/
... others that you advice
So,
Where I can get one of the above templates?
How can I install that?
What code should I put in a .rake file to generate the documentation with the chosen template?
In few words, I am a newbie in this matters.
At this time in my Gemfile I have stated the following:
gem "rdoc", "~> 3.6.1"
and run the bundle install command.
UPDATE I for #dmarkow
I installed the horo gem and inserted the following code in a my .rake file
RDoc::Task.new do |rdoc|
rdoc.title = "My Awesome docs"
rdoc.rdoc_dir = 'doc'
rdoc.options << '-f' << 'horo'
rdoc.options << '--main' << 'README'
end
If I run the command rdoc -f horo --main README.rdoc *.rdoc lib ext I get this:
file '*.rdoc' not found
file 'ext' not found
uh-oh! RDoc had a problem:
Directory doc already exists, but it looks like it isn't an RDoc directory.
Because RDoc doesn't want to risk destroying any of your existing files,
you'll need to specify a different output directory name (using the --op <dir>
option)
If I run the command rake doc:app I get this:
WARNING: Deprecated reference to top-level constant 'Task' found at: <my_application_projectfolder>/Rakefile:7:in `<top (required)>'
Use --classic-namespace on rake command
or 'require "rake/classic_namespace"' in Rakefile
rake aborted!
wrong number of arguments (0 for 2)
UPDATE II for #dmarkow
I removed the doc directory:
If I run the command rdoc -f horo --main README.rdoc *.rdoc lib ext I get this:
file '*.rdoc' not found
file 'ext' not found
No newer files.
Files: 0
Classes: 0 (0 undocumented)
Modules: 0 (0 undocumented)
Constants: 0 (0 undocumented)
Attributes: 0 (0 undocumented)
Methods: 0 (0 undocumented)
Total: 0 (0 undocumented)
0.00% documented
In the documentation directory it creates a created.rid file.
If I run the command rake doc:app I get the same as in the following UPDATE.
What I have to do? I have still to keep the gem "rdoc", "~> 3.6.1" in my Gemfile?
I prefer Hanna, resp Hanna-nouveau.
Hanna was fine, but it is based on an old rdoc-version. Hanna-nouveau base on the original Hanna, but it works with rdoc 3 (tested with rdoc 3.12).
It looks like
You may see another example in http://gems.rubypla.net/todonotes/0.1.0/
Details can be found at https://github.com/rdoc/hanna-nouveau. The Readme contains information about installation and usage.
Update 2014
Hanna-nouveau does not work with rdoc 4.
What you can do: Install an old rdoc-version (I use 3.12). There is no need to uninstall the most actual version. You can call rdoc version depending:
rdoc _3.12_ -f hanna [...more options...]
With _3.12_ the rdoc-version 3.12 is loaded. With -f hanna hanna-nouveau is used.
The one used at http://api.rubyonrails.org is the "Horo" template. You can find it here, along with instructions for using it (it's installed via a gem):
https://github.com/tenderlove/horo

Rails 3 - How do I get Rspec spec/ & autotest to work?

I was all setup with Rspec and Autotest before I updated to Rails 3.
When running rspec spec/ I'm getting:
* spec/spec.opts is deprecated.
* please use ./.rspec or ~/.rspec instead.
I tried changed spec.opts to spec.rspec and running rspec spec/ again. But now I get a whole mess of warnings:
DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated:
DEPRECATION WARNING: reset_javascript_include_default is deprecated. Please manipulate config.action_view.javascript_expansions[:defaults] directly.
DEPRECATION WARNING: RAILS_ENV is deprecated. Please use ::Rails.env.
DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated:
DEPRECATION WARNING: You are using the old router DSL which will be removed in Rails 3.1. Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/.
Autotest isn't working either. I'm getting:
.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I.:lib:test -rubygems -e "['test/unit', 'spec/integration/layout_links_spec.rb', 'test/unit/color_test.rb', 'test/functional/products_controller_test.rb', 'spec/integration/users_spec.rb', 'test/functional/colors_controller_test.rb', 'test/unit/product_test.rb', 'test/unit/helpers/products_helper_test.rb', 'test/unit/helpers/colors_helper_test.rb'].each { |f| require f }" | .rvm/gems/ruby-1.9.2-p0/gems/autotest-4.3.2/bin/unit_diff -u
:29:in require': no such file to load -- spec_helper (LoadError)
from <internal:lib/rubygems/custom_require>:29:inrequire'
from spec/integration/layout_links_spec.rb:1:in <top (required)>'
from <internal:lib/rubygems/custom_require>:29:inrequire'
from :29:in require'
from -e:1:inblock in '
from -e:1:in each'
from -e:1:in'
Any ideas?
The deprecation warnings are because of your upgrade to Rails 3, not because of RSpec. Rails 3 has a very different architecture, and the API has also changed significantly. Have you run your project through the rails_upgrade plugin? Also, check out the Rails 3 Release Notes for help on fixing the parts of your application that rely on deprecated functionality.
The second issue is probably because ruby 1.9.2 no longer puts the current directory on the load path. You'll need to manually include spec/ into the load path from your spec.opts.

Resources