problem with 'rspec_junit_formatter' when i doing
bundle exec rspec --format RspecJunitFormatter
i got errors like this,how to fix it?
home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/formatters/deprecation_formatter.rb:186:in `puts': Treating `metadata[:execution_result]` as a hash is deprecated. Use the attributes methods to access the data instead. Called from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec_junit_formatter-0.2.0/lib/rspec_junit_formatter/rspec3.rb:43:in `result_of'. (RSpec::Core::DeprecationError)
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/formatters/deprecation_formatter.rb:125:in `print_deprecation_message'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/formatters/deprecation_formatter.rb:36:in `deprecation'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/reporter.rb:137:in `block in notify'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/reporter.rb:136:in `each'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/reporter.rb:136:in `notify'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/reporter.rb:107:in `deprecation'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/warnings.rb:11:in `deprecate'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:455:in `issue_deprecation'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/metadata.rb:319:in `[]'
from /home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec_junit_formatter-
my Gemfile
group :development, :test do
gem 'capybara'
gem 'database_cleaner'
gem 'factory_girl_rails', '~> 4.0'
gem 'faker', git: 'https://github.com/stympy/faker.git'
gem 'pry'
gem 'rspec-rails', '~>3.0.0'
gem 'selenium-webdriver'
gem 'spork'
gem 'rspec_junit_formatter'
gem 'rspec-core'
end
I will be glad to any proposals .. Thanks
this is a known problem, fixed three months ago...
https://github.com/sj26/rspec_junit_formatter/commit/96f0115f7dabbea623f04b60dc23519683f39cfa
You might want to install the gem as...
gem 'rspec_junit_formatter', :git => 'https://github.com/sj26/rspec_junit_formatter.git'
Your formatter is using functionality that has been deprecated in rspec 3.
It would appear this has been fixed on the master branch of rspec_junit_formatter, although it may not be in a released gem you should be able to get it by specifying it as a git dependency in your Gemfile.
Related
Trying to upgrade from 2.14.2,to rspec 3.x get deprication messages
The `:example_group` key in an example group's metadata hash is deprecated. Use the example group's hash directly for the computed keys and `:parent_example_group` to access the parent example group metadata instead. Called from /home/georgi/ruby/xxx/spec/models/user_spec.rb:2:in `<top (required)>'.
This message is showed for every line in spec file that have 'describe'. Gems that i use in test env is
group :development, :test do
gem 'rspec-rails'
end
group :test do
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver', '~> 2.42.0'
gem 'shoulda-matchers'
gem 'rspec-retry'
gem 'simplecov'
end
Information from config.raise_errors_for_deprecations! configuration:
https://gist.github.com/tapalilov/b96b4e2f4237e2ecef84
How to remove these deprecation messages and how to change rspec configuration?
Best regards,
Georgi.
I'm a newby in Rails, and I'm developing some app with 3.2.0. So, all is good, it works on my local environment, but when I try to push it to Heroku there are troubles with assets - my css files don't compile into one application.css file, therefore my final application.css is clean (you can see it by link my app on Heroku). There are no problems on my local machine. I've found some answers in Google and people recommended do the following command:
RAILS_ENV=production bundle exec rake assets:precompile
I tried to do it and got the following output:
/Users/marya/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: No such file or directory -- ruby /Users/marya/.rvm/gems/ruby-1.9.3-p448#global/bin/rake assets:precompile (LoadError)
rake aborted!
Command failed with status (1): [/Users/marya/.rvm/rubies/ruby-1.9.3-p448/b...]
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `eval'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
I don't understand what it does mean, therefore I need your help. My Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.0'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
end
group :production do
gem 'pg', '0.12.2'
gem 'rails_12factor'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
If you need another project files, please, just tell me about it and Ill do it. Thanks in advance!
Seems to be an RVM quirk. I ran into this using rvm + ruby 2.0.0-p247 and this worked for me:
rvm ruby-2.0.0-p247#global do gem install executable-hooks
Like the headline said, I am getting the aforementioned error when I try to run my rspec tests. The exact error is (word wrapped for readability):
/.rvm/gems/ruby-1.9.3-p374/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:93:in
`<class:TestCase>': uninitialized constant
Test::Unit::TestCase::Assertions (NameError)
The main fix for this problem on the internet seems to be to remove the 'turn' gem, however I don't have the turn gem loaded. Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise'
gem 'therubyracer'
gem 'mysql2'
gem 'cucumber'
gem 'email_spec'
gem 'cancan'
gem 'rolify'
gem 'libv8'
gem 'simple_form'
group :test, :development do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'test-unit'
end
group :test do
gem 'cucumber-rails', :require => false
gem 'capybara'
gem 'database_cleaner'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass'
gem 'sass-rails', '~> 3.2.3'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
The part of my code that the test seems to be choking on is when I have this line in my require 'rspec/rails' in my rspec_helper.rb file.
This project used to run rspecs flawlessly. It's only when I did a reinstall of my OS that it began to behave badly.
Any help is greatly appreciated
Since your are not generating a new app, remove the line
gem 'test-unit'
from your Gemfile and remove the gems turn and minitest, followed by a bundle update.
Answer: If you look in my Gemfile, you see a requirement in my group :test, :development for gem 'test-unit'. I commented that out and it works like a charm. Why and how this works I have no idea, if someone would mind explaining go right ahead.
I've been self-learning developing rails plugin.
One referenced tutorial I'm using is here.
Unfortunately, it seemed I got stuck since the first step when I run "rails generate plugin. It's returning an error saying "rspec [not found]".
c:\rails\test\rails generate plugin HelloWorld
create vendor/plugins/hello_world
create vendor/plugins/hello_world/MIT-LICENSE
create vendor/plugins/hello_world/README
create vendor/plugins/hello_world/Rakefile
create vendor/plugins/hello_world/init.rb
create vendor/plugins/hello_world/install.rb
create vendor/plugins/hello_world/uninstall.rb
create vendor/plugins/hello_world/lib
create vendor/plugins/hello_world/lib/hello_world.rb
error rspec [not found]
I tried to look for possible solutions myself. One that I tried was making an update of the project's bundler gem in hope that might come from a bug of plugin compatibility.
anyway, just in case it would help give you guys some clue on where it could go wrong, I also post my GemFile as follows.
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'annotate', ">=2.5.0"
gem 'sqlite3'
gem 'faker', '0.3.1'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
gem 'pg', '0.14.0'
gem 'bundler', '1.2.0.rc.2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'rspec-rails', '2.6.1'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails', '1.0'
end
Any advice would be really appreciated!
I think it's trying to generate template rspec examples for the plugin, but the rspec directory isn't there. Did you run the rspec installer (rails g rspec:install) after adding rspec to your Gemfile?
I just setup my mac for development and used this exact gemfile previously and it worked fine. I am not sure what I am doing wrong.
Victorias-MacBook-Pro:sample_app Victoria$ bundle --without production
/Users/Victoria/Sites/sample_app/Gemfile:38:in `evaluate': compile error
/Users/Victoria/Sites/sample_app/Gemfile:28: syntax error, unexpected ':', expecting kEND
gem 'cucumber-rails', '1.2.1', require: false
^ (SyntaxError)
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:18:in `build'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:135:in `definition'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/cli.rb:220:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/vendor/thor/task.rb:22:in `send'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/vendor/thor/task.rb:22:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/vendor/thor.rb:263:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/vendor/thor/base.rb:386:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/bin/bundle:13
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19
There was an error in your Gemfile, and Bundler cannot continue.
This is the gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'jquery-rails', '2.0.0'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.5'
group :development, :test do
gem 'mysql2'
gem 'rspec-rails', '2.9.0'
gem 'guard-rspec', '0.5.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '1.4.0'
gem 'cucumber-rails', '1.2.1', require: false
gem 'database_cleaner', '0.7.0'
gem 'guard-spork', '0.3.2'
gem 'spork', '0.9.0'
# gem 'rb-fsevent', '0.4.3.1', require: false
# gem 'growl', '1.0.3'
end
group :production do
gem 'pg', '0.12.2'
end
You're running Ruby 1.8 and the syntax attribute: requires ruby 1.9. You will need to change
gem 'cucumber-rails', '1.2.1', require: false
to
gem 'cucumber-rails', '1.2.1', :require => false
Or install Ruby 1.9 (maybe using RVM or rbenv) and run bundle install again. This would be a much bettter option if it's a new project.
I got the same error after updating up my Ruby/Rails environment.
gem update bundler fixed it.
I just had a similar issue while using rvm. Here is what worked for me:
Check to see what version of rails you are using with rvm (in terminal):
ruby -v (in my case opened a new terminal with version set to ruby 1.8.7, yours may not be)
Switch to the correct ruby version (In my case it should be ruby 2.1.1, yours may not be):
rvm 2.1.1 (this sets the ruby version to 2.1.1, replace with your project's ruby x.x.x)
Try re-running bundle check:
bundle check
You should get:
The Gemfile's dependencies are satisfied
The above-mentioned answers did not work for me, but commenting out capistrano gems in the Gemfile did.
If you are using RVM, check which gemset you are using: rvm current.
If it says, for example, system, you may need to select the correct gemset (I did). Use rvm list gemsets if you can't remember what it's called, then select the correct gemset using rvm use [correct gemset].
I had an error similar to this but a bit more specific,
An error occurred while installing safe_yaml (1.0.5), and Bundler cannot continue
In this case, we have to install 'safe_yaml' as
gem install safe_yaml
The answer by #weiphi (https://stackoverflow.com/a/16820392/7668403) could help in such case if need to upgrade.