Permalink
Browse files

tests now stub color config, removed setter in config

  • Loading branch information...
1 parent 54b9e98 commit 505db9f237121f4eb062170cfb5d11b8a539555d @alexcoplan alexcoplan committed Jul 17, 2012
Showing with 6 additions and 14 deletions.
  1. +2 −10 lib/rspec/matchers/configuration.rb
  2. +4 −4 spec/rspec/expectations/differ_spec.rb
@@ -39,17 +39,9 @@ def syntax
syntaxes
end
- # Some methods for color config in Expectations.
- # Expectations should be independent from Core, therefore
- # color should fallback to being configurable here, if core
- # is not available.
- #
- # Tests to see if --color is available within expectations
- # should be made here
+ # color config for expectations
+ # fallback if rspec core not available
if defined?(RSpec::Core)
- def color=(bool)
- RSpec.configuration.color = bool
- end
def color?
RSpec.configuration.color
end
@@ -6,7 +6,7 @@ module Expectations
describe Differ do
context "without --color" do
- before { RSpec::Matchers.configuration.color = false }
+ before { RSpec::Matchers.configuration.stub(:color? => false) }
let(:differ) { RSpec::Expectations::Differ.new }
@@ -154,14 +154,14 @@ def inspect
diff.should == expected_diff
end
end
- end # end context
+ end
context "with --color" do
- before { RSpec::Matchers.configuration.color = true }
+ before { RSpec::Matchers.configuration.stub(:color? => true) }
let(:differ) { RSpec::Expectations::Differ.new }
- it "outputs coloured diffs" do
+ it "outputs colored diffs" do
expected = "foo bar baz"
actual = "foo bang baz"
expected_diff = "\n\e[34m@@ -1,2 +1,2 @@\n\e[0m\e[31m-foo bang baz\n\e[0m\e[33m+foo bar baz\n\e[0m"

0 comments on commit 505db9f

Please sign in to comment.