diff --git a/lib/capybara/rspec/features.rb b/lib/capybara/rspec/features.rb index 9b81aaba..bb5e1e17 100644 --- a/lib/capybara/rspec/features.rb +++ b/lib/capybara/rspec/features.rb @@ -7,11 +7,13 @@ module Capybara alias :xscenario :xit alias :given :let alias :given! :let! + alias :feature :describe end end end end + def self.feature(*args, &block) options = if args.last.is_a?(Hash) then args.pop else {} end options[:capybara_feature] = true diff --git a/spec/rspec/features_spec.rb b/spec/rspec/features_spec.rb index a2777950..ee23bff4 100644 --- a/spec/rspec/features_spec.rb +++ b/spec/rspec/features_spec.rb @@ -34,6 +34,21 @@ feature "Capybara's feature DSL" do scenario "doesn't pollute the Object namespace" do Object.new.respond_to?(:feature, true).should be_false end + + feature 'nested features' do + scenario 'work as expected' do + visit '/' + page.should have_content 'Hello world!' + end + + scenario 'are marked in the metadata as capybara_feature' do + example.metadata[:capybara_feature].should be_true + end + + scenario 'have a type of :feature' do + example.metadata[:type].should eq :feature + end + end end feature "given and given! aliases to let and let!" do