Sha256: 1c16bc50832c4af03d278508edfd6f273e1e6a3a7cd8361777ef7c9354eef4dd

Contents?: true

Size: 588 Bytes

Versions: 17

Compression:

Stored size: 588 Bytes

Contents

require 'lib/spec_helper'
require 'opal/cli_runners'
require 'rack/test'

RSpec.describe Opal::CliRunners::Server do
  include Rack::Test::Methods

  def app
    @app
  end

  it 'starts a server for the given code' do
    expect(Rack::Server).to receive(:start) do |options|
      @app = options[:app]
      expect(options[:Port]).to eq(1234)
    end

    builder = Opal::Builder.new
    builder.build_str("puts 123", "app.rb")
    described_class.call(builder: builder, options: {port: 1234})

    get '/cli_runner.js'
    expect(last_response.body).to include(".$puts(123)")
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
opal-1.5.1 spec/lib/cli_runners/server_spec.rb
opal-1.5.0 spec/lib/cli_runners/server_spec.rb
opal-1.5.0.rc1 spec/lib/cli_runners/server_spec.rb
opal-1.4.1 spec/lib/cli_runners/server_spec.rb
opal-1.4.0 spec/lib/cli_runners/server_spec.rb
opal-1.4.0.alpha1 spec/lib/cli_runners/server_spec.rb
opal-1.3.2 spec/lib/cli_runners/server_spec.rb
opal-1.3.1 spec/lib/cli_runners/server_spec.rb
opal-1.3.0 spec/lib/cli_runners/server_spec.rb
opal-1.3.0.rc1 spec/lib/cli_runners/server_spec.rb
opal-1.3.0.alpha1 spec/lib/cli_runners/server_spec.rb
opal-1.2.0 spec/lib/cli_runners/server_spec.rb
opal-1.2.0.beta1 spec/lib/cli_runners/server_spec.rb
opal-1.1.1 spec/lib/cli_runners/server_spec.rb
opal-1.1.1.rc1 spec/lib/cli_runners/server_spec.rb
opal-1.1.0 spec/lib/cli_runners/server_spec.rb
opal-1.1.0.rc1 spec/lib/cli_runners/server_spec.rb