lib/rspec_junit_formatter/rspec3.rb
def swap_rspec_configuration(key, value)
    unset = Object.new
    force = RSpec.configuration.send(:value_for, key) { unset }
    if unset.equal?(force)
      previous = RSpec.configuration.send(key)
      RSpec.configuration.send(:"#{key}=", value)
    else
      RSpec.configuration.force({key => value})
    end
    yield
  ensure
    if unset.equal?(force)
      RSpec.configuration.send(:"#{key}=", previous)
    else
      RSpec.configuration.force({key => force})
    end
  end
# rspec makes it really difficult to swap in configuration temporarily due to
# the way it cascades defaults, command line arguments, and user
# configuration. This method makes sure configuration gets swapped in
# correctly, but also that the original state is definitely restored.
rspec makes it really difficult to swap in configuration temporarily due to
the way it cascades defaults, command line arguments, and user
configuration. This method makes sure configuration gets swapped in
correctly, but also that the original state is definitely restored.
rspec makes it really difficult to swap in configuration temporarily due to the way it cascades defaults command line arguments and user configuration . This method makes sure configuration gets swapped in correctly but also that the original state is definitely restored .
def swap_rspec_configuration(key, value)
    unset = Object.new
    force = RSpec.configuration.send(:value_for, key) { unset }
    if unset.equal?(force)
      previous = RSpec.configuration.send(key)
      RSpec.configuration.send(:"#{key}=", value)
    else
      RSpec.configuration.force({key => value})
    end
    yield
  ensure
    if unset.equal?(force)
      RSpec.configuration.send(:"#{key}=", previous)
    else
      RSpec.configuration.force({key => force})
    end
  end
def swap_rspec_configuration ( key , value ) unset = Object . new force = RSpec . configuration . send ( :value_for , key ) { unset } if unset . equal? ( force ) previous = RSpec . configuration . send ( key ) RSpec . configuration . send ( :" #{ key } = " , value ) else RSpec . configuration . force ( { key => value } ) end yield ensure if unset . equal? ( force ) RSpec . configuration . send ( :" #{ key } = " , previous ) else RSpec . configuration . force ( { key => force } ) end end
rspec makes it really difficult to swap in configuration temporarily due to
the way it cascades defaults, command line arguments, and user
configuration.
rspec makes it really difficult to swap in configuration temporarily due to the way it cascades defaults command line arguments and user configuration .
key
value