I'm working on an exercise that gets me started on Test Driven Development Using RSpec
I've been following the instructions and I've created a file repository on GitHub, and performed gem install rspec. However, when I try to run commands to test RSpec is functioning it throws this massive error at me and I haven't been able to find out why. I'm somewhat used to using Ruby on Rails, but this is my first application outside the rails framework.
Here's the error:
/Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load': cannot load such file -- /Users/jrshafer/bloc/code/address-bloc/specs/entry_spaces.rb (LoadError) from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `load' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `<main>' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval' from /Users/jrshafer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
I'm usually pretty good at finding fixes for any kind of error during development but this one has me stuck. I'd appreciate any help you could give.
So, after staring at it for a while and comparing it to an example I realized I missed a case sensitive Entry in the RSpec.describe. Noob mistake.
Related
I’m using Rails 4.2.7 and just added the spreadsheet gem to my Gemfile
gem 'spreadsheet'
Sadly, when I execute this call against a file that ends in “.xls”
book = Spreadsheet.open file_location
I get the below error. Unfortunately, it is not an option to resave this document in another Excel format (I don’t even have Excel installed on my computer). How can I parse this xls file? I’m open to using another gem if it solves the problem.
Ole::Storage::FormatError: OLE2 signature is invalid
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:378:in `validate!'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:370:in `initialize'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:112:in `new'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:112:in `load'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:79:in `initialize'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:85:in `new'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/ruby-ole-1.2.12/lib/ole/storage/base.rb:85:in `open'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/spreadsheet-1.1.4/lib/spreadsheet/excel/reader.rb:1282:in `setup'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/spreadsheet-1.1.4/lib/spreadsheet/excel/reader.rb:140:in `read'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/spreadsheet-1.1.4/lib/spreadsheet/excel/workbook.rb:32:in `open'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/spreadsheet-1.1.4/lib/spreadsheet.rb:67:in `open'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/spreadsheet-1.1.4/lib/spreadsheet.rb:73:in `open'
from /Users/davea/Documents/workspace/myproject/app/services/xls_to_my_object_times_converter_service.rb:12:in `get_my_object_times'
from /Users/davea/Documents/workspace/myproject/app/services/xls_processor_service.rb:15:in `process_page_data'
from /Users/davea/Documents/workspace/myproject/app/services/abstract_import_service.rb:82:in `process_my_object_data'
from (irb):3
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in `start'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in `start'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
I had some problems with spreadsheet when I tried it. That was some time ago, so I don't recall exactly what happened but I believe it was a similar OLE error. It has been updated since then, as well. But, since you mentioned you would consider another gem, I switched to roo and it has worked quite well for me. One very strong benefit is that it can handle many different formats, not just Excel-compatible.
After installing Ruby, Cucumber and Watir using gem I get the following error:
uninitialized constant Cucumber::Rb_Support (NameError)
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:41:in `constantize_name'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:13:in `block in constantize'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:12:in `each'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/constantize.rb:12:in `constantize'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:87:in `load_programming_language'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:242:in `programming_language_for'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:226:in `load_file'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:97:in `block in load_files!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:96:in `each'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime/support_code.rb:96:in `load_files!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime.rb:242:in `load_step_definitions'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/runtime.rb:65:in `run!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/cli/main.rb:38:in `execute!'
W:/Programme/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/bin/cucumber:9:in `<top (required)>'
W:/Programme/Ruby193/bin/cucumber:23:in `load'
W:/Programme/Ruby193/bin/cucumber:23:in `<main>'**
Anyone got any idea why this is not working?
I copied the exact example from the github page.
I finally found a solution myself.
If anyone runs into this problem it is most likely caused by Ruby versions that are not compatible with Gherkin/Cucumber and/or Watir.
Although there are newer version of Ruby, the only versions that worked on my Windows 7 (Win64) machine were a combination of:
Ruby: rubyinstaller-2.0.0-p645.exe
DevKit: DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
Then I followed the installation instructions on http://www.spritecloud.com/2015/04/complete-setup-guide-for-ruby-cucumber-and-watir-on-windows/
And I used the example on https://github.com/spriteCloud/cucumber-watir-example which worked.
Following this did not create any errors and the example worked.
Good luck!
I am learning custom matchers for rspec from this old, 2008 tutorial - http://www.reactive.io/tips/2008/12/10/up-and-running-with-custom-rspec-matchers/
Project Structure
.
├── one_plus.rb
└── one_plus_spec.rb
I followed all the instructions, but I am not able to understand why I am getting the following error:
rspec one_plus_spec.rb
/home/john/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- one_plus (LoadError)
from /home/john/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/john/Code/Rspec/Misc/CustomRspecMatchers/one_plus_spec.rb:3:in `<top (required)>'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
from /home/john/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
john#ubuntu:~/Code/Rspec/Misc/CustomRspecMatchers$
There is no clear answer in other stack overflow questions for this. I don't just want a solution, but I also want to know why this error happens and the concepts that I need to learn to prevent it from happening again.
Try using require_relative instead:
require_relative 'one_plus'
./ (current directory) was removed from the load path in Ruby 1.9.
your load path doesn't include ./ by default, that's why.
Understanding Ruby's load paths includes details as well as solutions.
I personally use require_relative pretty often in specs myself, but you can also modify the load path.
I'm just starting Test First Ruby & I'm having trouble running rakes to start solving problems.
I think it's either my version of RSpec or my version of Ruby that's causing the error.
Here's the error,
AT MacBook-Pro:01_temperature AT$ rake
(in /Users/AT/Desktop/learn_ruby)
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- temperature (LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb:18:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `each'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:96:in `setup'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:84:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:69:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:37:in `invoke'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/exe/rspec:4:in `<top (required)>'
from /usr/bin/rspec:23:in `load'
from /usr/bin/rspec:23:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -S rspec /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb -I/Users/AT/Desktop/learn_ruby/01_temperature -I/Users/AT/Desktop/learn_ruby/01_temperature/solution -f documentation -r ./rspec_config failed
I had a similar problem a few minutes ago but fixed by uninstalling RSpec v-3, and installing v-2.14.
Any help would be appreciated!
Your file temperature_spec is requiring what I presume is the source for the class under test, temperature - but the RSpec loader is not able to resolve the path for this file.
It would be helpful for you to post both the source of your rspec file and your class under test.
I am doing the following:
gonvaled#pegasus $ bundle exec 'middleman build --verbose'
...
== Finishing Request: pages/forms/forms.html (0.04s)
update build/pages/forms/forms.html
error build/javascripts/vendor/jquery.easy-pie-chart
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:142:in `exec_runtime'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:19:in `eval'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:33:in `call'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:57:in `compile'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/coffee.rb:46:in `evaluate'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/template.rb:77:in `render'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `block in evaluate'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `each'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
/home/gonvaled/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:12:in `initialize'
...
Lots of things are building properly, but some are failing like this one. I have no idea what is failing: ruby does not mention any specific problem with the input file: the jquery.easy-pie-chart.coffee seems ok.
What can I try to debug this? I am new to ruby and middleman.
You may need to install a javascript runtime, like therubyracer.
My system had an (spurious) executable called nodejs in the PATH, and it was preventing the real nodejs to run. No messages about this where provided, so it was really difficult to find.