Sha256: 8784e8c34c97a4ed762e955e535703e680b344571698da2bd3242e8fc5ead5ab

Contents?: true

Size: 836 Bytes

Versions: 27

Compression:

Stored size: 836 Bytes

Contents

require "bot/rspec/syntax.rb"
require "bot/rspec/matchers.rb"
require "bot/rspec/fixnum_helper.rb"

module Bot
  module Rspec
    include Syntax
    include Matchers

    Fixnum.send(:include, FixnumHelper)

    def self.included(base)
      if base.metadata[:type] == :responder
        base.let(:username) { "user" } unless base.respond_to? :username
        base.let(:user) { create(:user) } unless base.respond_to? :user
        base.let(:message) { incoming_message(user.username) } unless base.respond_to? :message
        base.let(:handler) { class_double("Handler") } unless base.respond_to? :handler
        base.let(:responses) { [] } unless base.respond_to? :responses
        base.let(:responder) { base.described_class.new(message, user, responses, handler) } unless base.respond_to? :responder
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bot-0.0.46 lib/bot/rspec.rb
bot-0.0.45 lib/bot/rspec.rb
bot-0.0.44 lib/bot/rspec.rb
bot-0.0.43 lib/bot/rspec.rb
bot-0.0.42 lib/bot/rspec.rb
bot-0.0.41 lib/bot/rspec.rb
bot-0.0.40 lib/bot/rspec.rb
bot-0.0.39 lib/bot/rspec.rb
bot-0.0.38 lib/bot/rspec.rb
bot-0.0.37 lib/bot/rspec.rb
bot-0.0.35 lib/bot/rspec.rb
bot-0.0.34 lib/bot/rspec.rb
bot-0.0.33 lib/bot/rspec.rb
bot-0.0.32 lib/bot/rspec.rb
bot-0.0.31 lib/bot/rspec.rb
bot-0.0.30 lib/bot/rspec.rb
bot-0.0.29 lib/bot/rspec.rb
bot-0.0.28 lib/bot/rspec.rb
bot-0.0.27 lib/bot/rspec.rb
bot-0.0.26 lib/bot/rspec.rb