struct Athena::Mercure::Spec::MockHub

Overview

Similar to [AMC::Hub][] but does not make any requests to a real Mercure hub. Instead, it accepts a block that can be used to make assertions against the related [AMC::Update][], and is expected to return the id of the related update.

Included Modules

Defined in:

spec.cr

Constructors

Instance Method Summary

Instance methods inherited from module Athena::Mercure::Hub::Interface

public_url : String public_url, publish(update : AMC::Update) : String publish, token_factory : AMC::TokenFactory::Interface | Nil token_factory, token_provider : AMC::TokenProvider::Interface | Nil token_provider, url : String url

Constructor Detail

def self.new(url : String, token_provider : AMC::TokenProvider::Interface, public_url : String | Nil = nil, token_factory : AMC::TokenFactory::Interface | Nil = nil, &publisher : AMC::Update -> String) #

[View source]

Instance Method Detail

def public_url : String #

Returns the public URL of this hub used to subscribe.


[View source]
def publish(update : AMC::Update) : String #

Publishes the provided update to this hub.


[View source]
def token_factory : AMC::TokenFactory::Interface | Nil #

Returns the [AMC::TokenFactory::Interface][] associated with this hub.


[View source]
def token_provider : AMC::TokenProvider::Interface #

Returns the [AMC::TokenProvider::Interface][] associated with this hub.


[View source]
def url : String #

Returns the internal URL of this hub used to publish updates.


[View source]