minitest-rails-shoulda with minitest gives me undefined method `run_teardown_hooks' - shoulda

Help please:
I want to user shoulda with minitest.
This is the exception I get:
NoMethodError: undefined method `run_teardown_hooks' for #<#<Class:0x007fd42ed95490>:0x007fd42ed00c78>
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/mocha-0.10.5/lib/mocha/integration/mini_test/version_230_to_262.rb:39:in `run'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:425:in `_run__1339649173504478165__setup__555511959301366683__callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180#search_server/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
This is me gemfile:
gem 'minitest'
gem 'minitest-should_syntax'
gem 'miniskirt'
gem 'rack-livereload'
gem 'guard'
gem 'guard-minitest'
gem 'guard-bundler'
gem 'guard-livereload'
gem 'annotate', ">=2.5.0"
gem 'guard-annotate'
gem "rb-fsevent"
gem 'database_cleaner'
gem "minitest-rails-shoulda"
gem 'sqlite3', :require => 'sqlite3'
This is my test_helper:
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/should_syntax'
require 'factories/factories'
class ActionController::TestCase
include Devise::TestHelpers
end

In your Gemfile, specify gem 'shoulda-matchers', '1.4.1' and then run bundle update shoulda-matchers
Explanation
shoulda-matchers 1.4.2 introduced a dependency on bourne, which is dependent on a version of mocha that is broken by minitest because run_setup_hooks and run_teardown_hooks have been removed from minitest.
Here's a bug report for shoulda-matchers that explains what's going on: https://github.com/thoughtbot/shoulda-matchers/issues/235
If you are affected by this problem, take a moment to +1 the bug report, so that it gets a little love.

Related

Error installing nokogiri: Failed to build gem native extension

I want to execute the following command
bundle install && rake install
but an error comes up and I try to figure out whats going on. I found that i need to install nokogiri. But when I try to install it an error comes up again. Any ideas? :/
sudo gem install nokogiri -v '1.8.5'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20181210-12550-orku3c.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.3.0
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/nokogiri-1.8.5 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/gem_make.out

Chef build error on AWS Linux AMI

In the last few days we've had a previously working AWS Cloud Formation and associated Chef script start failing. At this point there does not seem to be any identifiable reason for this. If anyone has any insights as to the potential cause and/or solution to this we'd love to hear it. Below is the error log from chef-client.log:
[2015-03-26T23:20:31+00:00] INFO: Processing execute[resize2fs /dev/xvda1 2>/dev/null] action run (base::default line 26) [2015-03-26T23:20:31+00:00] INFO: execute[resize2fs /dev/xvda1 2>/dev/null] ran successfully [2015-03-26T23:20:31+00:00] INFO: Processing yum_package[git] action install (base::default line 29) [2015-03-26T23:20:34+00:00] INFO: Processing yum_package[htop] action install (base::default line 30) [2015-03-26T23:20:34+00:00] INFO: yum_package[htop] installing htop-1.0.1-2.3.amzn1 from amzn-main repository [2015-03-26T23:20:38+00:00] INFO: Processing directory[/var/builds/dependencies/] action create (base::common_dependencies line 9) [2015-03-26T23:20:38+00:00] INFO: directory[/var/builds/dependencies/] created directory /var/builds/dependencies/ [2015-03-26T23:20:38+00:00] INFO: Processing s3_file[/var/builds/dependencies/deploy_key] action create (base::common_dependencies line 14) [2015-03-26T23:20:38+00:00] INFO: Processing chef_gem[rest-client] action install (dynamically defined)
================================================================================ Error executing action `install` on resource 'chef_gem[rest-client]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------ Expected process to exit with [0], but received '1'
---- Begin output of /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" ---- STDOUT: Successfully installed netrc-0.10.3 Building native extensions. This could take a while... STDERR: WARNING: You don't have /.chefdk/gem/ruby/2.1.0/bin in your PATH,
gem executables will not run. ERROR: Error installing rest-client:
ERROR: Failed to build gem native extension.
/opt/chefdk/embedded/bin/ruby -r ./siteconf20150326-4306-ptf6fb.rb extconf.rb checking for main() in -lstdc++... *** extconf.rb failed
*** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chefdk/embedded/bin/ruby
--with-stdc++lib
--without-stdc++lib /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:552:in `try_link0'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:567:in `try_link'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:753:in `try_func'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:984:in `block in have_library'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:929:in `block in checking_for'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:928:in `checking_for'
from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:979:in `have_library'
from extconf.rb:2:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /.chefdk/gem/ruby/2.1.0/gems/unf_ext-0.0.6 for inspection. Results logged to /.chefdk/gem/ruby/2.1.0/extensions/x86_64-linux/2.1.0/unf_ext-0.0.6/gem_make.out
---- End output of /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" ---- Ran /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" returned 1
Cookbook Trace:
--------------- /etc/chef/local-mode-cache/cache/cookbooks/s3_file/providers/default.rb:8:in `block in class_from_file'
Compiled Resource:
------------------
# Declared in
chef_gem("rest-client") do action :install retries 0 retry_delay 2 default_guard_interpreter :default package_name "rest-client" version "1.8.0" timeout 900 gem_binary "/opt/chefdk/embedded/bin/gem" end
The rubygem rest-client was updated recently:
1.8.0 - March 24, 2015 (122 KB)
This adds a dependency to http-cookie gem, which resolves in dependencies to domain_name, unf and unf_ext which needs a C++ compiler and libstdc++ (https://github.com/knu/ruby-unf_ext, Requirement)
For CentOS this means: yum install gcc-c++ libstdc++-devel
I created an issue on their bug tracker (https://github.com/rest-client/rest-client/issues/371)

Cucumber/JRuby - uninitialized constant Syntax::Ruby::Set Error creating formatter: html (NameError)

I'm using a JRUBY/Cucumber/Watir framework and I have one specific features folder that keeps throwing this error every I try to use the built in HTML formatter:
uninitialized constant Syntax::Ruby::Set
Error creating formatter: html (NameError)
org/jruby/RubyModule.java:2690:in `const_missing'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax /lang/ruby.rb:11:in `Ruby'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax /lang/ruby.rb:8:in `Syntax'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/lang/ruby.rb:3:in `(root)'
org/jruby/RubyKernel.java:1083:in `require'
/Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:1:in `(root)'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:24:in `load'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/convertors/abstract.rb:16:in `for_syntax'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:580:in `SnippetExtractor'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:578:in `Html'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:8:in `Formatter'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:7:in `Cucumber'
org/jruby/RubyKernel.java:1083:in `require'
/Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:6:in `(root)'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:1:in `(root)'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:17:in `constantize'
org/jruby/RubyArray.java:2409:in `map'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:81:in `formatter_class'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:182:in `formatters'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:178:in `formatters'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:76:in `build_tree_walker'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/runtime.rb:46:in `run!'
org/jruby/RubyKernel.java:1099:in `load'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/main.rb:47:in `execute!'
org/jruby/RubyKernel.java:1119:in `eval'
/Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/bin/jruby_executable_hooks:15:in `(root)'
Using cucumber-1.3.14 and jruby-1.7.10 , although the error occurs with jruby-1.7.4. There are no formatters included in the support directory or referenced anywhere in the env.rb. Not using rake or anything ust running individual features. The strange thing is that other feature folders can output html reports with the same command arguments as the one that fails. Example:
cucumber features/AddText.feature -f html -o report.html -f pretty
or
cucumber features/AddText.feature --format html --out report.html --format pretty
Any insight would be helpful.
UPDATE:
For some reason uninstalling then 'syntax' gem allows features to run and html reports to be generated. I was under the impression that 'syntax' was a 'cucumber' dependency...
When a test failure occurs in Cucumber, the following line is written to the console:
# gem install syntax to get syntax highlighting
Unfortunately, this causes people to install the syntax gem, which is the cause of your error.
Do 'gem uninstall syntax' or 'sudo gem uninstall syntax' to avoid this error.
Run "gem uninstall syntax" this will work
i know this is bit old thread, but would like to clear somethings out.
cucumber 1.3.17 and 1.3.18 dependent on syntax >= 1.0.0
and in the current case, problem is syntax 1.2.0 and not all version of syntax.
so what we should do is
uninstall syntax 1.2.0 and install syntax 1.0.0
sudo gem install syntax -v 1.0.0

Error while installing cucumber on maverick

I am getting following error..
RROR: Error installing calabash-cucumber:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-gherkin_lexer_ar-dir
--without-gherkin_lexer_ar-dir
--with-gherkin_lexer_ar-include
--without-gherkin_lexer_ar-include=${gherkin_lexer_ar-dir}/include
--with-gherkin_lexer_ar-lib
--without-gherkin_lexer_ar-lib=${gherkin_lexer_ar-dir}/
--with-clib
--without-clib
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:509:in `block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:88:in `mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:506:in `try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:530:in `try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:716:in `try_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:946:in `block in have_library'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:941:in `have_library'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/gherkin-2.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/gherkin-2.12.2/ext/gherkin_lexer_ar/gem_make.out
The telling line in the exception trace is this:
The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
From Terminal, run xcode-select --install to install the necessary tools and then give installing Cucumber another go.

Installing Cucumber on IronRuby (native json issue)

I am trying to install Cucumber on IronRuby 1.1.3 using gem install cucumber but I keep getting the following error:
Building native extensions. This could take a while...
ERROR: Error installing cucumber:
ERROR: Failed to build gem native extension.
"d:/Program Files (x86)/IronRuby 1.1/bin/ir.exe" extconf.rb
d:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/mkmf.rb:9:in `const_missing':
uninitialized constant RbConfig::MAKEFILE_CONFIG (NameError)
from d:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/mkmf.rb:9
from d:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/custom_
require.rb:29:in `require'
from d:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/custom_
require.rb:29:in `require'
from extconf.rb:1
Here's the problem:
Failed to build gem native extension
Some gems when they get installed compile C extensions as part of the process; the above library is one of them. Other examples are Nokogiri and Gherkin. The resulting libraries are not .net-based and as such can't be used by IronRuby. IronRuby only deals in managed code so you can only use 'pure' ruby gems, or .net DLLs.

Resources