Module: Logux::Test::Helpers

Defined in:
lib/logux/test/helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
# File 'lib/logux/test/helpers.rb', line 6

def self.included(base)
  base.before do
    Logux::Test::Store.instance.reset!
  end
end

Instance Method Details

#a_logux_action_with(attributes = {}) ⇒ Object Also known as: a_logux_action



25
26
27
# File 'lib/logux/test/helpers.rb', line 25

def a_logux_action_with(attributes = {})
  RSpec::Matchers::BuiltIn::Include.new(attributes.stringify_keys)
end

#a_logux_meta_with(attributes = {}) ⇒ Object Also known as: a_logux_meta



20
21
22
# File 'lib/logux/test/helpers.rb', line 20

def a_logux_meta_with(attributes = {})
  RSpec::Matchers::BuiltIn::Include.new(attributes.stringify_keys)
end

#logux_approved(meta = nil) ⇒ Object



30
31
32
33
34
# File 'lib/logux/test/helpers.rb', line 30

def logux_approved(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['approved'], excludes: %w[forbidden error]
  )
end

#logux_authenticated(meta = nil) ⇒ Object



54
55
56
57
58
# File 'lib/logux/test/helpers.rb', line 54

def logux_authenticated(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['authenticated']
  )
end

#logux_denied(meta = nil) ⇒ Object



66
67
68
69
70
# File 'lib/logux/test/helpers.rb', line 66

def logux_denied(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['denied']
  )
end

#logux_errored(meta = nil) ⇒ Object



48
49
50
51
52
# File 'lib/logux/test/helpers.rb', line 48

def logux_errored(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['error']
  )
end

#logux_forbidden(meta = nil) ⇒ Object



42
43
44
45
46
# File 'lib/logux/test/helpers.rb', line 42

def logux_forbidden(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['forbidden']
  )
end

#logux_processed(meta = nil) ⇒ Object



36
37
38
39
40
# File 'lib/logux/test/helpers.rb', line 36

def logux_processed(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['processed'], excludes: %w[forbidden error]
  )
end

#logux_storeObject



12
13
14
# File 'lib/logux/test/helpers.rb', line 12

def logux_store
  Logux::Test::Store.instance.data
end

#logux_unauthorized(meta = nil) ⇒ Object



60
61
62
63
64
# File 'lib/logux/test/helpers.rb', line 60

def logux_unauthorized(meta = nil)
  Logux::Test::Matchers::ResponseChunks.new(
    meta: meta, includes: ['unauthorized']
  )
end

#send_to_logux(*commands) ⇒ Object



16
17
18
# File 'lib/logux/test/helpers.rb', line 16

def send_to_logux(*commands)
  Logux::Test::Matchers::SendToLogux.new(*commands)
end