Skip to content

Commit

Permalink
Merge pull request teamcapybara#1279 from twalpole/basic_object
Browse files Browse the repository at this point in the history
use BasicObject so global includes don't break CSSHandlers
  • Loading branch information
twalpole committed Apr 2, 2014
2 parents a2ec9c1 + 744bd8d commit 4739a99
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/capybara/rack_test/css_handlers.rb
@@ -1,4 +1,6 @@
class Capybara::RackTest::CSSHandlers
class Capybara::RackTest::CSSHandlers < BasicObject
include ::Kernel

def disabled list
list.find_all { |node| node.has_attribute? 'disabled' }
end
Expand Down
14 changes: 14 additions & 0 deletions spec/rack_test_spec.rb
Expand Up @@ -157,3 +157,17 @@ module TestSessions
end
end
end

module CSSHandlerIncludeTester
def dont_extend_css_handler
raise 'should never be called'
end
end
include CSSHandlerIncludeTester

describe Capybara::RackTest::CSSHandlers do
it "should not be extended by global includes" do
expect(Capybara::RackTest::CSSHandlers.new).not_to respond_to(:dont_extend_css_handler)
end
end

0 comments on commit 4739a99

Please sign in to comment.