Mixing Watir::Browser into RSpec
As far as I can tell, you have 4 options:


Use the current code as-is (and, as you say, risk stepping on an existing method_missing).
You can use RSpec's config.extend to at least limit the inclusion.
You can skip method_missing in favor of creating a module explicit method declarations for anything you want to forward to @browser. This is no doubt the safest, but also the most laborious, solution. Still, I'd consider it
You can do something like below, which, admittedly, is somewhat hacky.




module Session_FF

  # Alias existing method_missing implementation when being included
  def Session_FF.append_features(target)
    if target.instance_methods.include?(:method_missing)
      target.send(:alias_method, :overriden_method_missing, :method_missing)
    end
    super
  end

  # Define your own method_missing which forwards to @browser
  # or to the previous method_missing (if any)
  def method_missing(name, *args, &amp;block)
    if @browser.respond_to?(name)
      @browser.send(name, *args, &amp;block)
    elsif respond_to?(:overriden_method_missing)
      overriden_method_missing(name, *args, &amp;block)
    end
  end

  def element(*args)
    # ...
  end

end


Should work, although if @browser also relies on method_missing without a reliable respond_to?, you might have better luck simply trying to call a method @browser and rescue a NoMethodError. Not very pretty, though.

On a side-note, I think it's perhaps a little strange that the module is named _FF when the @browser could be something other than Firefox. WatirSession might be  a more inclusive name.