Class: Webspicy::Specification::Service
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#method_missing, #to_info
Constructor Details
#initialize(raw) ⇒ Service
Returns a new instance of Service.
6
7
8
9
10
|
# File 'lib/webspicy/specification/service.rb', line 6
def initialize(raw)
super(raw)
bind_examples
bind_counterexamples
end
|
Instance Attribute Details
#specification ⇒ Object
Also known as:
resource
Returns the value of attribute specification.
11
12
13
|
# File 'lib/webspicy/specification/service.rb', line 11
def specification
@specification
end
|
Class Method Details
.info(raw) ⇒ Object
16
17
18
|
# File 'lib/webspicy/specification/service.rb', line 16
def self.info(raw)
new(raw)
end
|
Instance Method Details
#conditions ⇒ Object
32
33
34
|
# File 'lib/webspicy/specification/service.rb', line 32
def conditions
preconditions + postconditions
end
|
#config ⇒ Object
20
21
22
|
# File 'lib/webspicy/specification/service.rb', line 20
def config
specification.config
end
|
#counterexamples ⇒ Object
68
69
70
|
# File 'lib/webspicy/specification/service.rb', line 68
def counterexamples
@raw[:counterexamples] || []
end
|
#default_example ⇒ Object
60
61
62
|
# File 'lib/webspicy/specification/service.rb', line 60
def default_example
@raw[:default_example]
end
|
#description ⇒ Object
28
29
30
|
# File 'lib/webspicy/specification/service.rb', line 28
def description
@raw[:description]
end
|
#dress_params(params) ⇒ Object
93
94
95
|
# File 'lib/webspicy/specification/service.rb', line 93
def dress_params(params)
input_schema.dress(params)
end
|
#errconditions ⇒ Object
52
53
54
|
# File 'lib/webspicy/specification/service.rb', line 52
def errconditions
@errconditions ||= compile_errconditions
end
|
#error_schema ⇒ Object
89
90
91
|
# File 'lib/webspicy/specification/service.rb', line 89
def error_schema
@raw[:error_schema]
end
|
#examples ⇒ Object
64
65
66
|
# File 'lib/webspicy/specification/service.rb', line 64
def examples
@raw[:examples] || []
end
|
#generated_counterexamples ⇒ Object
72
73
74
75
76
77
78
79
|
# File 'lib/webspicy/specification/service.rb', line 72
def generated_counterexamples
preconditions.map{|pre|
pre.counterexamples(self).map{|tc|
tc = config.factory.test_case(tc, Webspicy.current_scope)
tc.bind(self, true)
}
}.flatten
end
|
#has_errconditions? ⇒ Boolean
56
57
58
|
# File 'lib/webspicy/specification/service.rb', line 56
def has_errconditions?
!errconditions.empty?
end
|
#has_postconditions? ⇒ Boolean
48
49
50
|
# File 'lib/webspicy/specification/service.rb', line 48
def has_postconditions?
!postconditions.empty?
end
|
#has_preconditions? ⇒ Boolean
40
41
42
|
# File 'lib/webspicy/specification/service.rb', line 40
def has_preconditions?
!preconditions.empty?
end
|
81
82
83
|
# File 'lib/webspicy/specification/service.rb', line 81
def input_schema
@raw[:input_schema]
end
|
#name ⇒ Object
24
25
26
|
# File 'lib/webspicy/specification/service.rb', line 24
def name
@raw[:name]
end
|
#output_schema ⇒ Object
85
86
87
|
# File 'lib/webspicy/specification/service.rb', line 85
def output_schema
@raw[:output_schema]
end
|
#postconditions ⇒ Object
44
45
46
|
# File 'lib/webspicy/specification/service.rb', line 44
def postconditions
@postconditions ||= compile_postconditions
end
|
#preconditions ⇒ Object
36
37
38
|
# File 'lib/webspicy/specification/service.rb', line 36
def preconditions
@preconditions ||= compile_preconditions
end
|
#to_s ⇒ Object
97
98
99
|
# File 'lib/webspicy/specification/service.rb', line 97
def to_s
"#{method} #{specification.url}"
end
|