Skip to content

Commit

Permalink
Added Capybara support
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicklas committed Oct 25, 2011
1 parent ce90013 commit 1ca78cf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/turnip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@
require "turnip/step_definition"
require "turnip/dsl"
require "turnip/rspec"

module Turnip
class << self
attr_accessor :type
end
end

Turnip.type = :turnip
16 changes: 16 additions & 0 deletions lib/turnip/capybara.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'capybara/rspec'

Turnip.type = :request

RSpec.configure do |config|
config.before do
if self.class.include?(Capybara::DSL) and example.metadata[:turnip]
Capybara.current_driver = Capybara.javascript_driver if example.metadata.has_key?(:javascript)
example.metadata.each do |tag, value|
if Capybara.drivers.has_key?(tag)
Capybara.current_driver = tag
end
end
end
end
end

0 comments on commit 1ca78cf

Please sign in to comment.