Sha256: 8a7a39e88935b602dab1c30c80452fb00181e2c68e6a93cf3291cb070fbdcd8a

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require "rspec"
require "rspec/expectations"
require "rspec/mocks"

major, *_unused = RSpec::Core::Version::STRING.split(/\./)
abort "RSpec 3 or greater required" if major.to_i < 3

require "moneta"
require "set"

require "waylon/core"
require "waylon/skills/default"
require "waylon/rspec/skill"
require "waylon/rspec/test_channel"
require "waylon/rspec/test_message"
require "waylon/rspec/test_sense"
require "waylon/rspec/test_user"
require "waylon/rspec/test_worker"

module Waylon
  # RSpec stuff that allows specialized Waylon testing
  module RSpec
    class << self
      # @param base [Object] The class including the module.
      # @return [void]
      def included(base)
        base.class_eval do
          before do
            config = Waylon::Config.instance
            config.load_env
            Waylon::Cache.clear
            Waylon::Storage.clear

            Waylon::RSpec::TestChannel.find_or_create("random")
            Waylon::RSpec::TestUser.find_or_create(
              name: "Waylon Smithers",
              email: "waylon.smithers@example.com"
            )
            Waylon::RSpec::TestUser.find_or_create(name: "Homer Simpson")
          end
        end
      end
    end
  end
end

Waylon::Cache = Moneta.new(:Cookie)
Waylon::Storage::Store = Moneta.new(:Cookie)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
waylon-core-0.2.0 lib/waylon/rspec.rb
waylon-core-0.1.9 lib/waylon/rspec.rb
waylon-core-0.1.8 lib/waylon/rspec.rb
waylon-core-0.1.6 lib/waylon/rspec.rb