appacademy / prep-work

preparatory material for interviewing with App Academy
291 stars 340 forks source link

Updated rspec dependency version for coding-test-2 #68

Closed JoshCantor closed 9 years ago

JoshCantor commented 9 years ago

When I ran the coding-test-2 tests I received the following error:

undefined method `include_chain_clauses_in_custom_matcher_descriptions=' 
for #<RSpec::Expectations::Configuration:0x007fd945923c10> (NoMethodError)

It seems this configuration setting is only present in updated versions of rspec. However, the gemfile specified rspec version 2.

rglassett commented 9 years ago

Can you post the command you ran, along with the full stack trace of the error? Thanks!

JoshCantor commented 9 years ago
Josh$ bundle exec rspec 
/Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/spec/spec_helper.rb:31:in `block (2 levels) in <top (required)>': undefined method `include_chain_clauses_in_custom_matcher_descriptions=' for #<RSpec::Expectations::Configuration:0x007fd945923c10> (NoMethodError)
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:545:in `expect_with'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/spec/spec_helper.rb:23:in `block in <top (required)>'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core.rb:79:in `configure'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/spec/spec_helper.rb:19:in `<top (required)>'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1025:in `require'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1025:in `block in requires='
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1025:in `each'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration.rb:1025:in `requires='
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration_options.rb:100:in `each'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration_options.rb:100:in `process_options_into'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/configuration_options.rb:22:in `configure'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:96:in `setup'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:85:in `run'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:70:in `run'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:38:in `invoke'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.0.4/exe/rspec:4:in `<top (required)>'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/bin/rspec:23:in `load'
    from /Users/Josh/Desktop/prep-work-master/coding-test-2/practice-problems/vendor/bundle/ruby/2.1.0/bin/rspec:23:in `<main>'
rglassett commented 9 years ago

I'm unable to reproduce the bug using Ruby 2.1.0 on my end. Based on the stack trace, it looks like the incorrect version of rspec was being used (3.0.4 instead of 2.x.x). I'm going to hold off on merging this for now.

JoshCantor commented 9 years ago

I believe I've figured out the issue:

I followed the "practice problem instructions" in prep-work/coding-test-2/practice-problems and received an error saying spec_helper.rb was missing . Thinking this was an rspec issue, I downloaded rspec directly from github and ran rspec --init. This installed the latest versions of both rspec and spec_helper.rb. As a result, the older rspec version specified in the prep-work dependencies was trying to use the newest spec_helper.rb.

A full uninstall/reinstall just took care of the issues. The one difference was that I ran rspec --init after running bundle install. As far as I can tell, the "practice problem instructions" do not include a direction to run rspec --init after bundle install.

rglassett commented 9 years ago

Thanks for the update! Glad to hear you resolved the issue. It shouldn't be necessary to run rspec --init for these problems, so I'll leave things as they are.

JoshCantor commented 9 years ago

No worries! When I ran bundle exec rspec spec/00_nearest_larger_spec.rb after running bundle install, I received an error saying spec_helper.rb was missing -- where does spec_helper.rb come from without running rspec --init?

rglassett commented 9 years ago

There is no spec_helper.rb file for these exercises, and RSpec shouldn't be attempting to require it. This might be a configuration issue; check practice_problems/.rspec and ~/.rspec, and remove the line --require spec_helper if you see it.