Module: RSpec::Matchers

Defined in:
lib/rspec/sse/matchers.rb

Instance Method Summary collapse

Instance Method Details

#be_sse_event_data(*data, json: false) ⇒ Object

Matches if the response’s event data match the expected data in order



50
51
52
# File 'lib/rspec/sse/matchers.rb', line 50

def be_sse_event_data(*data, json: false)
  RSpec::SSE::Matchers::BeEventData.new(data.flatten, json:)
end

#be_sse_event_ids(*ids) ⇒ Object

Matches if the response’s event IDs match the expected IDs in order



58
59
60
# File 'lib/rspec/sse/matchers.rb', line 58

def be_sse_event_ids(*ids)
  RSpec::SSE::Matchers::BeEventIds.new(ids.flatten)
end

#be_sse_event_types(*types) ⇒ Object

Matches if the response’s event types match the expected types in order



41
42
43
# File 'lib/rspec/sse/matchers.rb', line 41

def be_sse_event_types(*types)
  RSpec::SSE::Matchers::BeEventTypes.new(types.flatten)
end

#be_sse_events(*events, json: false) ⇒ Object

Matches if the response’s events match the expected events in order



33
34
35
# File 'lib/rspec/sse/matchers.rb', line 33

def be_sse_events(*events, json: false)
  RSpec::SSE::Matchers::BeEvents.new(events.flatten, json:)
end

#be_sse_gracefully_closedObject

Matches if the response body ends with “nn”(SSE graceful close)



17
18
19
# File 'lib/rspec/sse/matchers.rb', line 17

def be_sse_gracefully_closed
  RSpec::SSE::Matchers::BeGracefullyClosed.new
end

#be_sse_reconnection_times(*times) ⇒ Object

Matches if the response’s reconnection times match the expected times in order



66
67
68
# File 'lib/rspec/sse/matchers.rb', line 66

def be_sse_reconnection_times(*times)
  RSpec::SSE::Matchers::BeReconnectionTimes.new(times.flatten)
end

#be_sse_successfully_openedObject

Matches if the response indicates successfully SSE connection opened



24
25
26
# File 'lib/rspec/sse/matchers.rb', line 24

def be_sse_successfully_opened
  RSpec::SSE::Matchers::BeSuccessfullyOpened.new
end

#contain_exactly_sse_event_data(*data, json: false) ⇒ Object

Matches if the response’s event data contain the expected data regardless of order



92
93
94
# File 'lib/rspec/sse/matchers.rb', line 92

def contain_exactly_sse_event_data(*data, json: false)
  RSpec::SSE::Matchers::ContainExactlyEventData.new(data.flatten, json:)
end

#contain_exactly_sse_event_ids(*ids) ⇒ Object

Matches if the response’s event IDs contain the expected IDs regardless of order



100
101
102
# File 'lib/rspec/sse/matchers.rb', line 100

def contain_exactly_sse_event_ids(*ids)
  RSpec::SSE::Matchers::ContainExactlyEventIds.new(ids.flatten)
end

#contain_exactly_sse_event_types(*types) ⇒ Object

Matches if the response’s event types contain the expected types regardless of order



83
84
85
# File 'lib/rspec/sse/matchers.rb', line 83

def contain_exactly_sse_event_types(*types)
  RSpec::SSE::Matchers::ContainExactlyEventTypes.new(types.flatten)
end

#contain_exactly_sse_events(*events, json: false) ⇒ Object

Matches if the response’s events contain the expected events regardless of order



75
76
77
# File 'lib/rspec/sse/matchers.rb', line 75

def contain_exactly_sse_events(*events, json: false)
  RSpec::SSE::Matchers::ContainExactlyEvents.new(events.flatten, json:)
end

#contain_exactly_sse_reconnection_times(*times) ⇒ Object

Matches if the response’s reconnection times contain the expected times regardless of order



108
109
110
# File 'lib/rspec/sse/matchers.rb', line 108

def contain_exactly_sse_reconnection_times(*times)
  RSpec::SSE::Matchers::ContainExactlyReconnectionTimes.new(times.flatten)
end

#have_sse_event_data(*data, json: false) ⇒ Object

Matches if the response’s event data include all the expected data



134
135
136
# File 'lib/rspec/sse/matchers.rb', line 134

def have_sse_event_data(*data, json: false)
  RSpec::SSE::Matchers::HaveEventData.new(data.flatten, json:)
end

#have_sse_event_ids(*ids) ⇒ Object

Matches if the response’s event IDs include all the expected IDs



142
143
144
# File 'lib/rspec/sse/matchers.rb', line 142

def have_sse_event_ids(*ids)
  RSpec::SSE::Matchers::HaveEventIds.new(ids.flatten)
end

#have_sse_event_types(*types) ⇒ Object

Matches if the response’s event types include all the expected types



125
126
127
# File 'lib/rspec/sse/matchers.rb', line 125

def have_sse_event_types(*types)
  RSpec::SSE::Matchers::HaveEventTypes.new(types.flatten)
end

#have_sse_events(*events, json: false) ⇒ Object

Matches if the response’s events include all the expected events



117
118
119
# File 'lib/rspec/sse/matchers.rb', line 117

def have_sse_events(*events, json: false)
  RSpec::SSE::Matchers::HaveEvents.new(events.flatten, json:)
end

#have_sse_reconnection_times(*times) ⇒ Object

Matches if the response’s reconnection times include all the expected times



150
151
152
# File 'lib/rspec/sse/matchers.rb', line 150

def have_sse_reconnection_times(*times)
  RSpec::SSE::Matchers::HaveReconnectionTimes.new(times.flatten)
end