Sha256: ab24ba6c6d12775dca8677639dd2d457b1ab8e95c3774e755f83699ba69e63d9

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe "playground", js: true do

  it "works!" do
    mount "SuperTest::Derp" do
      module SuperTest
      end

      SuperTest.const_set :Derp, Class.new(React::Component::Base)
      SuperTest::Derp.class_eval do
      	inherited(self)
      	def render
      		p {"hi"}
      	end
      end
      SuperTest::Derp.hypertrace instrument: :all
    end
    page.should have_content('hi')
    pause
  end

  it "works! as well" do

    mount "SuperTest::Derp" do
      module SuperTest
      end

      # YOU HAVE TO have the parens otherwise ruby rules say that
      # the block will be sent to const_set (where it is ignored)

      SuperTest.const_set(:Derp, Class.new(React::Component::Base) do
        inherited(self)
        def render
          p {"hi"}
        end
      end)
      SuperTest::Derp.hypertrace instrument: :all
    end
    page.should have_content('hi')
    pause
  end

  it "works!?" do

    mount "SuperTest::Derp" do
      module SuperTest
      end

      SuperTest.const_set(:Derp, Class.new do
        #include React::Component
        #inherited(self)
        def render
          p {"hi"}
        end
      end)
      SuperTest::Derp.hypertrace instrument: :all
    end
    pause
    page.should have_content('hi')
    pause
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyper-mesh-0.6.0 spec/play_ground.rb
hyper-mesh-0.5.4 spec/play_ground.rb
hyper-mesh-0.5.3 spec/reactive_record/play.rb
hyper-mesh-0.5.2 spec/reactive_record/play.rb
hyper-mesh-0.5.1 spec/reactive_record/play.rb
hyper-mesh-0.5.0 spec/reactive_record/play.rb
hyper-mesh-0.4.0 spec/reactive_record/play.rb