Skip to content

Commit

Permalink
Merge pull request #1113 from tgaff/tg/nested_features
Browse files Browse the repository at this point in the history
Permit nested features
  • Loading branch information
jnicklas committed Jul 10, 2013
2 parents 50993f2 + c7cb9e9 commit 61524b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/capybara/rspec/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ def self.included(base)
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
Expand Down
15 changes: 15 additions & 0 deletions spec/rspec/features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@
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
Expand Down

0 comments on commit 61524b0

Please sign in to comment.