From fee2a70220a2d358999b6bd50fefb6c36f179a7f Mon Sep 17 00:00:00 2001 From: Luismi Cavalle Date: Sat, 12 Mar 2011 12:38:48 +0100 Subject: [PATCH] RSpec DSL should not pollute the Object namespace --- lib/capybara/rspec/features.rb | 2 +- spec/rspec/features_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/capybara/rspec/features.rb b/lib/capybara/rspec/features.rb index 097c44a1..064fc8c7 100644 --- a/lib/capybara/rspec/features.rb +++ b/lib/capybara/rspec/features.rb @@ -9,7 +9,7 @@ module Capybara end end -def feature(*args, &block) +def self.feature(*args, &block) options = if args.last.is_a?(Hash) then args.pop else {} end options[:capybara_feature] = true options[:type] = :request diff --git a/spec/rspec/features_spec.rb b/spec/rspec/features_spec.rb index 92849ca5..55d5af4b 100644 --- a/spec/rspec/features_spec.rb +++ b/spec/rspec/features_spec.rb @@ -24,6 +24,10 @@ feature "Capybara's feature DSL" do scenario "runs background" do @in_background.should be_true end + + scenario "doesn't pollute the Object namespace" do + Object.new.respond_to?(:feature, true).should be_false + end end feature "Capybara's feature DSL with driver", :driver => :culerity do