Sha256: 542dd62e295da9f4253b1effb2f01cd40b5f80fcb55cc72af8390e4875bdca0d

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"
require "open-uri"
require "cypress_rails"
require "cypress_rails/server"

RSpec.describe CypressRails::Server do
  describe "#port" do
    subject(:port) { described_class.new("localhost").port }

    it "assigns a port number from the ephemeral range" do
      expect(49152..65535).to cover(port)
    end

    it { is_expected.to be_open_port }
  end

  describe "#start" do
    subject(:server) { described_class.new("localhost") }

    it "starts the server and blocks until it is ready" do
      CypressRails.configure do |config|
        config.server_command = "rackup spec/support/dummy/config.ru"
      end

      response = nil
      server.start {
        response = open("http://localhost:#{server.port}")
      }
      expect(response.status).to include "200"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cypress_rails-0.1.0 spec/cypress_rails/server_spec.rb