Sha256: 4b36bb754bbd2adcd48e3f78b655bc57d05895db9dbc4960c6bbf20be438bf07

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

if opal?
  RSpec.describe React::Test::DSL do
    describe 'the DSL' do
      let(:session) { Class.new { include React::Test::DSL }.new }

      before do
        React::Test.reset_session!

        stub_const 'Greeter', Class.new
        Greeter.class_eval do
          include React::Component

          params do
            optional :message
            optional :from
          end

          def render
            span { "Hello #{params.message}" }
          end
        end
      end

      it 'is possible to include it in another class' do
        session.mount(Greeter)
        expect(session.instance).to be_a(Greeter)
      end

      it "should provide a 'component' shortcut for more expressive tests" do
        session.component.mount(Greeter)
        expect(session.component.instance).to be_a(Greeter)
      end

      React::Test::Session::DSL_METHODS.each do |method|
        it "responds to all DSL method: #{method}" do
          expect(session).to respond_to(method)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
hyper-react-0.12.7 spec/react/test/dsl_spec.rb
hyper-react-0.12.6 spec/react/test/dsl_spec.rb
hyper-react-0.12.5 spec/react/test/dsl_spec.rb
hyper-react-0.12.4 spec/react/test/dsl_spec.rb
hyper-react-0.12.3 spec/react/test/dsl_spec.rb
hyper-react-0.12.2 spec/react/test/dsl_spec.rb
hyper-react-0.12.1 spec/react/test/dsl_spec.rb
hyper-react-0.12.0 spec/react/test/dsl_spec.rb
hyper-react-0.11.0 spec/react/test/dsl_spec.rb
hyper-react-0.10.0 spec/react/test/dsl_spec.rb
reactrb-0.9.0 spec/react/test/dsl_spec.rb