Sha256: 092d4954f9f1f0745e5039e6a09ec10b6a1a403893ad9665f26b42fb899120dd

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

require 'active_support'
require 'evostream/action/action'
require 'evostream/cli/runner'
require 'evostream/event'
require 'faker'
require 'json'
require 'webmock/rspec'
require 'capybara/rspec'
require 'active_support/core_ext/hash'

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

Dir['spec/support/**/*.rb'].each do |f|
  require File.expand_path(f)
end

# Load custom matchers
Dir['spec/matchers/*.rb'].each { |f| require File.expand_path(f) }

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  # Disable all remote connections
  WebMock.disable_net_connect!(allow_localhost: true)

  # Exclude spec broken
  config.filter_run_excluding broken: true

  # Configure Service DSL
  config.before do
    Evostream::Service.configuration do |c|
      c.uri_in     = 'http://server_stream.local:80'
      c.uri_out    = 'http://server_stream.local:7777'
      c.name       = 'srteamming_'
      c.web_root   = '/var/www/html'
      c.model      = Test
      c.model_id   = :identifier_used_in_model
    end
  end

  # Configure test Net::HTTP
  config.before(:each, type: :request) do
    stub_request(:get, /server_stream.local/)
      .with(headers: { 'Accept': '*/*', 'User-Agent': 'Ruby' })
      .to_return(status: 200, body: '', headers: {})
  end

  config.before(:each, type: :response) do
    stub_request(:any, /server_stream.local/).to_rack(FakeEvostream)
  end

  config.before(:each, type: :cli) do
    server = double('server').as_null_object
    TCPSocket.stub(:new).and_return(server)
  end
end

# Class for testing
class Test
  def self.find_by(id)
    id
  end
end

# Class for testing model stream
class Hls; end

# Class for testing model stream
class Dash; end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
evostream-event-1.0.2.pre.75 spec/spec_helper.rb
evostream-event-1.0.2.pre.74 spec/spec_helper.rb
evostream-event-1.0.1 spec/spec_helper.rb
evostream-event-1.0.1.pre.72 spec/spec_helper.rb
evostream-event-1.0.0 spec/spec_helper.rb
evostream-event-1.0.0.pre.69 spec/spec_helper.rb