require "spec_helper"

describe "configuration" do
  before do
    @orig_render_views = RSpec.configuration.render_views?
  end

  after do
    RSpec.configuration.render_views = @orig_render_views
  end

  describe "#render_views?" do
    it "is false by default" do
      expect(RSpec.configuration.render_views?).to be_falsey
    end
  end

  describe "#render_views" do
    it "sets render_views? to return true" do
      RSpec.configuration.render_views = false
      RSpec.configuration.render_views

      expect(RSpec.configuration.render_views?).to be_truthy
    end
  end
end

require "spec_helper"

RSpec.describe "Configuration" do

  subject(:config) { RSpec.configuration.clone }

  describe "#render_views?" do
    it "is false by default" do
      expect(config.render_views?).to be_falsey
    end
  end

  describe "#render_views" do
    it "sets render_views? to return true" do
      expect {
        config.render_views
      }.to change { config.render_views? }.to be_truthy
    end
  end
end

Update spec to remove hooks.
Update spec to remove hooks.

This changes to nearly mirrors how the configuration is tested in rspec-core.
Instead of setting up a new configuration object each test run, we clone
the existing object. This does two things:

- prevents polluting the actual test configuration
- instead of creating a new configuration it clones the existing one to
  ensure we actually modify the RSpec config
