Skip to content

Commit

Permalink
Merge pull request #2159 from rspec/dont-use-kernel-require
Browse files Browse the repository at this point in the history
Make syntax highlighting work when the coderay gem is installed but n…
  • Loading branch information
myronmarston committed Jan 23, 2016
2 parents d2ab059 + 372c03d commit 7054dce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Expand Up @@ -8,6 +8,9 @@ Bug Fixes:
* Fix `--drb` so that when no DRb server is running, it prevents
the DRb connection error from being listed as the cause of all
expectation failures. (Myron Marston, #2156)
* Fix syntax highlighter so that it works when the `coderay` gem is
installed as a rubygem but not already available on your load path
(as happens when you use bundler). (Myron Marston, #2159)

### 3.4.1 / 2015-11-18
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.0...v3.4.1)
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/source/syntax_highlighter.rb
Expand Up @@ -30,7 +30,7 @@ def implementation

def color_enabled_implementation
@color_enabled_implementation ||= begin
::Kernel.require 'coderay'
require 'coderay'
CodeRayImplementation
rescue LoadError
NoSyntaxHighlightingImplementation
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/source/syntax_highlighter_spec.rb
Expand Up @@ -47,7 +47,7 @@ class RSpec::Core::Source

context "when CodeRay is unavailable" do
before do
allow(::Kernel).to receive(:require).with("coderay").and_raise(LoadError)
allow(highlighter).to receive(:require).with("coderay").and_raise(LoadError)
end

it 'does not highlight the syntax' do
Expand Down

0 comments on commit 7054dce

Please sign in to comment.