Sha256: cbf65ae6cd73ad99da3b794aecb895188c52e268f70a475702538c487b181f90

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require 'pakyow-support'
require 'pakyow-core'
require 'pakyow-presenter'
require 'pakyow-mailer'
require 'pakyow-realtime'
require 'pakyow-ui'

require_relative 'test_help/ext/request'
require_relative 'test_help/ext/response'

require_relative 'test_help/mocks/presenter_mock'
require_relative 'test_help/mocks/status_mock'

require_relative 'test_help/observables/observable_presenter'
require_relative 'test_help/observables/observable_view'
require_relative 'test_help/observables/observable_logger'
require_relative 'test_help/observables/realtime/observable_context'
require_relative 'test_help/observables/realtime/observable_mutator'

require_relative 'test_help/helpers'
require_relative 'test_help/simulator'
require_relative 'test_help/simulation'

module Pakyow
  module TestHelp
    def self.setup(path = './app/setup')
      require path

      Pakyow::App.after :match do
        @presenter = Pakyow::TestHelp::ObservablePresenter.new(@presenter)
      end

      Pakyow::App.before :process do
        Pakyow::TestHelp::Realtime::ObservableMutator.instance.reset
      end

      Pakyow::App.stage(ENV['TEST_ENV'] || :test)
    end
  end
end

Pakyow::Presenter::ViewContext::VIEW_CLASSES << Pakyow::TestHelp::ObservableView

module Pakyow
  module Helpers
    def socket
      @socket ||= Pakyow::TestHelp::Realtime::ObservableContext.new(app)
    end
  end
end

module Pakyow
  module Presenter
    class ViewContext
      def mutate(mutator, data: nil, with: nil)
        Pakyow::TestHelp::Realtime::ObservableMutator.instance.mutate(mutator, self, data || with || [])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pakyow-test-0.10.2 pakyow-test/lib/pakyow-test.rb
pakyow-test-0.10.1 pakyow-test/lib/pakyow-test.rb
pakyow-test-0.10.0 pakyow-test/lib/pakyow-test.rb