Skip to content

Commit

Permalink
RSpec: disable monkey patching
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Nov 20, 2017
1 parent 12e013a commit 8e0868a
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion spec/integration/instance_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rainbow'

describe 'Custom Rainbow instance' do
RSpec.describe 'Custom Rainbow instance' do
it 'inherits enabled state from the global instance' do
Rainbow.enabled = :yep
expect(Rainbow.new.enabled).to eq(:yep)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/rainbow_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rainbow'

describe 'Rainbow() wrapper' do
RSpec.describe 'Rainbow() wrapper' do
before do
Rainbow.enabled = true
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/string_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rainbow/ext/string'

describe 'String mixin' do
RSpec.describe 'String mixin' do
before do
Rainbow.enabled = true
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/uncolor_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rainbow'

describe 'uncolor method' do
RSpec.describe 'uncolor method' do

it 'strips ansi color escape code' do
expect(Rainbow.uncolor("\e[35mhello\e[0mm")).to eq 'hellom'
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
end

Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |file| require file }

RSpec.configure do |config|
config.disable_monkey_patching!
end
2 changes: 1 addition & 1 deletion spec/support/presenter_shared_examples.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
shared_examples_for "presenter with shortcut color methods" do
RSpec.shared_examples_for "presenter with shortcut color methods" do
%i[black red green yellow blue magenta cyan white aqua].each do |name|
describe "##{name}" do
subject { presenter.public_send(name) }
Expand Down
10 changes: 5 additions & 5 deletions spec/unit/color_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rainbow/color'

module Rainbow
describe Color do
RSpec.describe Color do
describe '.build' do
subject { described_class.build(ground, values) }

Expand Down Expand Up @@ -77,7 +77,7 @@ module Rainbow
end
end

describe Color::Indexed do
RSpec.describe Color::Indexed do
let(:color) { described_class.new(ground, 5) }

describe '#codes' do
Expand All @@ -97,7 +97,7 @@ module Rainbow
end
end

describe Color::Named do
RSpec.describe Color::Named do
let(:color) { described_class.new(ground, name) }

describe '#codes' do
Expand Down Expand Up @@ -225,7 +225,7 @@ module Rainbow
end
end

describe Color::RGB do
RSpec.describe Color::RGB do
let(:color) { described_class.new(ground, r, g, b) }

describe '#codes' do
Expand Down Expand Up @@ -266,7 +266,7 @@ module Rainbow
end
end

describe Color::X11Named do
RSpec.describe Color::X11Named do
let(:color) { described_class.new(ground, name) }

describe '#codes' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/namespace_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rainbow'

describe Sickill::Rainbow do
RSpec.describe Sickill::Rainbow do
describe '.enabled' do
before do
::Rainbow.enabled = :nope
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/null_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rainbow/null_presenter'

module Rainbow
describe NullPresenter do
RSpec.describe NullPresenter do
let(:presenter) { described_class.new('hello') }

shared_examples_for "rainbow null string method" do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rainbow/presenter'

module Rainbow
describe Presenter do
RSpec.describe Presenter do
let(:presenter) { described_class.new('hello') }

shared_examples_for "rainbow string method" do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/string_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rainbow/string_utils'

module Rainbow
describe StringUtils do
RSpec.describe StringUtils do
describe '.wrap_with_sgr' do
subject { described_class.wrap_with_sgr(string, codes) }

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rainbow/wrapper'

module Rainbow
describe Wrapper do
RSpec.describe Wrapper do
let(:wrapper) { described_class.new(enabled) }

it "is enabled by default" do
Expand Down

0 comments on commit 8e0868a

Please sign in to comment.