Capybara::DSL
en la librería
capybara/dsl
,
la Session es inicializada automaticamente.
[~/sinatra/sinatra-selenium/intro(master)]$ cat hello_lpp_dsl.rb require 'capybara/dsl' require 'capybara/poltergeist' include Capybara::DSL Capybara.default_driver = :poltergeist visit "http://nereida.deioc.ull.es/~lpp/perlexamples/" if has_content?("Apuntes de RUBY") puts "All shiny, captain!" else puts ":( no tagline found, possibly something's broken" exit(-1) end
Al ejecutar este programa obtenemos un warning:
[~/sinatra/sinatra-selenium/intro(master)]$ ruby hello_lpp_dsl.rb including Capybara::DSL in the global scope is not recommended! All shiny, captain!
Si queremos silenciar este warning podemos usar la opción -W
del intérprete Ruby estableciendo el nivel a 0:
[~/sinatra/sinatra-selenium/intro(master)]$ ruby -W0 hello_lpp_dsl.rb All shiny, captain!