Skip to content

Commit

Permalink
Merge pull request #1162 from asmega/result_sample
Browse files Browse the repository at this point in the history
Results can now be sampled.
  • Loading branch information
jnicklas committed Sep 19, 2013
2 parents d76c013 + b9c88ee commit 6d4fad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/capybara/result.rb
Expand Up @@ -29,7 +29,7 @@ def initialize(elements, query)
@query = query
end

def_delegators :@result, :each, :[], :at, :size, :count, :length, :first, :last, :empty?, :inspect
def_delegators :@result, :each, :[], :at, :size, :count, :length, :first, :last, :empty?, :inspect, :sample

def matches_count?
Capybara::Helpers.matches_count?(@result.size, @query.options)
Expand Down
4 changes: 4 additions & 0 deletions spec/result_spec.rb
Expand Up @@ -48,4 +48,8 @@
memo += element.text[0]
end.should == 'ABGD'
end

it 'can be sampled' do
result.should include(result.sample)
end
end

0 comments on commit 6d4fad6

Please sign in to comment.