Class: VCR::Request::Typed

Inherits:
self
  • Object
show all
Defined in:
lib/vcr/structs.rb

Overview

Decorates a VCR::Request with its current type.

Direct Known Subclasses

FiberAware

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, type) ⇒ Typed



227
228
229
230
# File 'lib/vcr/structs.rb', line 227

def initialize(request, type)
  @type = type
  super(request)
end

Instance Attribute Details

#typeSymbol (readonly)



223
224
225
# File 'lib/vcr/structs.rb', line 223

def type
  @type
end

Instance Method Details

#externally_stubbed?Boolean

Returns whether or not this request is being stubbed by an external library (such as WebMock).



248
249
250
# File 'lib/vcr/structs.rb', line 248

def externally_stubbed?
  type == :externally_stubbed
end

#ignored?Boolean



233
234
235
# File 'lib/vcr/structs.rb', line 233

def ignored?
  type == :ignored
end

#real?Boolean

Note:

VCR allows :ignored and :recordable requests to be made for real.

Returns whether or not this request will be made for real.



264
265
266
# File 'lib/vcr/structs.rb', line 264

def real?
  ignored? || recordable?
end

#recordable?Boolean



253
254
255
# File 'lib/vcr/structs.rb', line 253

def recordable?
  type == :recordable
end

#stubbed?Boolean

Returns whether or not this request will be stubbed. It may be stubbed by an external library or by VCR.



272
273
274
# File 'lib/vcr/structs.rb', line 272

def stubbed?
  stubbed_by_vcr? || externally_stubbed?
end

#stubbed_by_vcr?Boolean

Returns whether or not this request is being stubbed by VCR.



240
241
242
# File 'lib/vcr/structs.rb', line 240

def stubbed_by_vcr?
  type == :stubbed_by_vcr
end

#unhandled?Boolean



258
259
260
# File 'lib/vcr/structs.rb', line 258

def unhandled?
  type == :unhandled
end