Sha256: b85a2592654ff4c5edd7223b6f6adc3bdacd4642ea0f567455a7f5a24aa21a24

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'vendor/jquery'
require 'opal-rspec'
require 'opal-jquery'
require 'vienna'
require 'vienna/template_view'

class SimpleModel < Vienna::Model
  attribute :name
end

class User < Vienna::Model
  attributes :foo, :bar, :baz
end

class AdvancedModel < Vienna::Model
  primary_key :title
end

module ViennaSpecHelper
  # Add some html to the document for tests to use. Code is added then
  # removed before each example is run.
  #
  #     describe "some feature" do
  #       html "<div>bar</div>"
  #
  #       it "should have bar content" do
  #         # ...
  #       end
  #     end
  #
  # @param [String] html_string html content
  def html(html_string = "")
    html = %Q{<div id="vienna-spec-test-div">#{html_string}</div>}

    before do
      @_spec_html = Element.parse(html)
      @_spec_html.append_to_body
    end

    after do
      @_spec_html.remove
    end
  end
end

RSpec.configure do |config|
  config.extend ViennaSpecHelper

  config.before(:each) do
    SimpleModel.reset!
    AdvancedModel.reset!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-vienna-0.7.0 spec/spec_helper.rb