Class: Peck::Should::ResponseRequirement
- Inherits:
-
Proxy
- Object
- Proxy
- Peck::Should::ResponseRequirement
- Defined in:
- lib/peck_on_rails.rb
Direct Known Subclasses
Constant Summary collapse
- SUPPORTED_VERBS =
[:get, :post, :put, :delete, :options]
Instance Attribute Summary collapse
-
#expected ⇒ Object
Returns the value of attribute expected.
-
#method ⇒ Object
Returns the value of attribute method.
Class Method Summary collapse
Instance Method Summary collapse
- #define_specification(verb, action, params = {}) ⇒ Object
- #method_missing(method, *attributes, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *attributes, &block) ⇒ Object
268 269 270 271 272 273 274 275 |
# File 'lib/peck_on_rails.rb', line 268 def method_missing(method, *attributes, &block) verb = method.to_sym if self.class.supported_verbs.include?(verb) define_specification(verb, *attributes) else super end end |
Instance Attribute Details
#expected ⇒ Object
Returns the value of attribute expected.
257 258 259 |
# File 'lib/peck_on_rails.rb', line 257 def expected @expected end |
#method ⇒ Object
Returns the value of attribute method.
257 258 259 |
# File 'lib/peck_on_rails.rb', line 257 def method @method end |
Class Method Details
.supported_verbs ⇒ Object
277 278 279 |
# File 'lib/peck_on_rails.rb', line 277 def self.supported_verbs SUPPORTED_VERBS end |
Instance Method Details
#define_specification(verb, action, params = {}) ⇒ Object
259 260 261 262 263 264 265 266 |
# File 'lib/peck_on_rails.rb', line 259 def define_specification(verb, action, params={}) _method = self.method _expected = self.expected context.it(description(verb, action, params)) do send(verb, action, immediate_values(params)) send(_method).should == _expected end end |