spec/spec_helper.rb in opal-jquery-0.3.0.beta1 vs spec/spec_helper.rb in opal-jquery-0.3.0.beta2

- old
+ new

@@ -1,35 +1,13 @@ require 'opal-rspec' -require 'opal-jquery' +require 'opal/jquery' +require 'opal/jquery/rspec' -module JqueryHelpers - # Add some html code to the body tag ready for testing. This will - # be added before each test, then removed after each test. It is - # convenient for adding html setup quickly. The code is wrapped - # inside a div, which is directly inside the body element. - # - # describe "DOM feature" do - # html <<-HTML - # <div id="foo"></div> - # HTML - # - # it "foo should exist" do - # Document["#foo"] - # end - # end - # - # @param [String] html_string html content to add - def html(html_string='') - html = %Q{<div id="opal-jquery-test-div">#{html_string}</div>} - - before do - @_spec_html = Element.parse(html) - @_spec_html.append_to_body - end - - after { @_spec_html.remove } +module JQueryTestHelpers + def find(selector) + Element.find selector end end RSpec.configure do |config| - config.extend JqueryHelpers + config.include JQueryTestHelpers end