lib/mechanical-cuke.rb in mechanical-cuke-0.4.3 vs lib/mechanical-cuke.rb in mechanical-cuke-0.5.0
- old
+ new
@@ -1,7 +1,6 @@
require 'mechanize'
-require 'mechanical-cuke/web_steps'
require 'mechanical-cuke/save_and_open'
module MechanicalCuke
class << self
attr_accessor :save_and_open_page_path
@@ -24,22 +23,25 @@
def response_body
current_page.body
end
+ def body
+ current_page.body
+ end
+
+ def form
+ current_page.forms.first
+ end
+
def basic_auth(username,password)
mechanize.basic_auth(username,password)
end
end
-World(MechanicalCuke)
-
private
-def form
- current_page.forms.first
-end
def find_by_id(id)
node = current_page.search("##{id}")
node.first
end
@@ -97,6 +99,11 @@
if (node = find_by_label(field))
return form.checkbox_with(:node => node)
end
return nil
+end
+
+unless defined?(Capybara)
+ require 'mechanical-cuke/web_steps'
+ World(MechanicalCuke)
end