undefined method `ruby' for #<Bundler::Dsl:0x007fc17c3fc6c8> (NoMethodError) - ruby

Just pulled latest code and now getting:
...my_app/Gemfile:2:in `evaluate':
undefined method `ruby' for #<Bundler::Dsl:0x007fc17c3fc6c8> (NoMethodError)

The ruby method that allows you to specify the version of Ruby your project should use was only added in Bundler 1.2. You’ve got a project with a Gemfile that uses this new ruby method, but have an old version of Bundler. You just need to get Bundler 1.2 with
gem install bundler
and you should be good to go.

Related

Problems upgrading Rails 4.0.0 to 4.0.x (4.0.13) - private method `include' called for ActionDispatch::Assertions:Module (NoMethodError)

I could not find a "direct" answer to this anywhere. Since I know there will be many other "Late Upgraders" to the party, I feel I need to get this out.
I had a Rails 4.0.0 app running Ruby 2.0.0-p247. After upgrading to 4.0.13, I ran into this error:
private method `include' called for ActionDispatch::Assertions:Module (NoMethodError)
I received this through rspec and WEBrick.
I found a solution via another issue from layer-ruby: NoMethodError: private method `include' called for #-Class:#-Layer::RelationProxy:0x007fd1f67016e0--
geoffreymm discovered that install Ruby 2.2.0 Fixed the issue.
I installed Ruby 2.2.5, and it did indeed solve the issue for me.

undefined method `execute_script' in page object gem

I have started to get this error when running my tests using the 1.2.2 version of the page object gem
Stacktrace
undefined method `execute_script' for <Selenium::WebDriver::Firefox::Bridge:0x00000003cbdba0> (NoMethodError)
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/element.rb:146:in `parent'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:30:in `find_index_by_title'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:15:in `[]'
It occurs when trying to get the value from a table using a method such as
left_table_element[rank][column]
NB. This had been previously working for over a year so I wonder if a new issue has been introduced?
Looking at the git blame it does seem like the line of code throwing the error in the element.rb might have been changed recently and maybe caused this regression?
The problem is due a change in Selenium-WebDriver. In version 3.0.0, the Remote::Bridge#executeScript method was renamed to #execute_script.
The Page-Object gem was updated in version 1.2.2 to use the new method. However, the gem dependencies were not updated to reflect the required version - ie Selenium-WebDriver v2.53.4 is still listed as the minimum requirement. It looks like this has already been fixed in the eventual Page-Object v2.0 release.
In the meantime, you can fix the issue by upgrading to Selenium-WebDriver v3 (assuming you do not want to downgrade Page-Object):
gem install selenium-webdriver
To fix this issue just need to update your page-object gem to 1.2.2 version
gem install -v 1.2.2 (for selenium-webdriver 3.x only)

How to fix Travis error: NoMethodError: undefined method `spec' for nil:NilClass

This is the error reported by Travis CI when it try to build my gem under Ruby 1.9.3:
NoMethodError: undefined method `spec' for nil:NilClass
I cannot find any reason or source for this error.
This is causing build failures which is misleading people into believing that the code in the gem itself is incorrect.
Why might this be happening and how can I fix it?
I believe it is due to Travis using an old version of Bundler. Adding the code below to the .travis.yml file should fix it:
before_install:
- gem install bundler
(Found at https://github.com/travis-ci/travis-ci/issues/3531.)
(Example of usage is at https://github.com/keithrbennett/trick_bag/blob/master/.travis.yml#L5-6.)
That's good, if you found a solution.
I had a similar problem that travis wasn't able to run my rspec tests. I edited my .travis.yml to create some binstubs on bundle install in my project. This way I can call bin/rspec easily from my project and run my tests.
My .travis.yml:
language: ruby
rvm:
- 2.3.0
bundler_args: --binstubs
script:
- bundle install
- bin/rspec spec

Ruby undefined local variable byebug

I'm executing the file app.rb in my rails project and trying to step through it using the byebug gem, but I get an error saying 'byebug' is an undefined local variable. I'm running the code using the command 'ruby app.rb'. Is there a different way to step through a ruby file when executing it this way via the command line?
$ bundle install
Fetching gem metadata from https://rubygems.org/.....
Resolving dependencies...
Using byebug 6.0.2
Installing pg 0.18.3
Using bundler 1.6.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ ruby app.rb
app.rb:17:in `block in <main>': undefined local variable or method `byebug' for main:Object (NameError)
from app.rb:15:in `glob'
from app.rb:15:in `<main>'
Looks like I just had to add require "byebug" at the top my app.rb file.
Another debugging option is the debugger gem:
require 'debugger'; debugger
https://github.com/cldwalker/debugger

is there a version of soap4r / wsdl2ruby that works with ruby 1.9.2?

As suggested in Ruby soap4r wsdl2ruby.rb errors, I loaded the soap4r gem from git://github.com/felipec/soap4r.git and made the change at line 66 in xmlparser.rb
c.downcase == name
to
c.to_s.downcase == name
But when I run:
wsdl2ruby.rb --wsdl http://docs.arrayent.com/zamapi.xml --type client --force
after a bunch of warnings, it eventually blows up with:
F, [2012-06-01T07:54:26.319928 #285] FATAL -- app: Detected an exception. Stopping ... undefined method `collect' for #<String:0x00000100c4a418> (NoMethodError)
/Users/r/Developer/Topaz/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:239:in `trim_eol'
Since 'String#collect' was valid in previous versions of Ruby, my hunch is that this wsdl2ruby hasn't been updated for Ruby 1.9.2.
Is there a newer one? Or a patch?
you may try to install this gem https://rubygems.org/gems/mumboe-soap4r . It solved my problems.

Resources