Class: Webspicy::Specification::TestCase
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#method_missing, #to_info
Constructor Details
#initialize(raw) ⇒ TestCase
Returns a new instance of TestCase.
6
7
8
9
|
# File 'lib/webspicy/specification/test_case.rb', line 6
def initialize(raw)
super(raw)
@counterexample = nil
end
|
Instance Attribute Details
#counterexample ⇒ Object
Returns the value of attribute counterexample.
11
12
13
|
# File 'lib/webspicy/specification/test_case.rb', line 11
def counterexample
@counterexample
end
|
#service ⇒ Object
Returns the value of attribute service.
10
11
12
|
# File 'lib/webspicy/specification/test_case.rb', line 10
def service
@service
end
|
Class Method Details
.info(raw) ⇒ Object
34
35
36
|
# File 'lib/webspicy/specification/test_case.rb', line 34
def self.info(raw)
new(raw)
end
|
Instance Method Details
#assert ⇒ Object
115
116
117
|
# File 'lib/webspicy/specification/test_case.rb', line 115
def assert
@raw[:assert] || []
end
|
#bind(service, counterexample) ⇒ Object
13
14
15
16
17
|
# File 'lib/webspicy/specification/test_case.rb', line 13
def bind(service, counterexample)
@service = service
@counterexample = counterexample
self
end
|
#body ⇒ Object
67
68
69
|
# File 'lib/webspicy/specification/test_case.rb', line 67
def body
@raw[:body]
end
|
#counterexample? ⇒ Boolean
23
24
25
|
# File 'lib/webspicy/specification/test_case.rb', line 23
def counterexample?
!!@counterexample
end
|
#description ⇒ Object
38
39
40
|
# File 'lib/webspicy/specification/test_case.rb', line 38
def description
@raw[:description]
end
|
#dress_params ⇒ Object
Also known as:
dress_params?
58
59
60
|
# File 'lib/webspicy/specification/test_case.rb', line 58
def dress_params
@raw.fetch(:dress_params){ true }
end
|
#example? ⇒ Boolean
19
20
21
|
# File 'lib/webspicy/specification/test_case.rb', line 19
def example?
!@counterexample
end
|
#expected ⇒ Object
79
80
81
|
# File 'lib/webspicy/specification/test_case.rb', line 79
def expected
@raw[:expected] || {}
end
|
#expected_content_type ⇒ Object
83
84
85
|
# File 'lib/webspicy/specification/test_case.rb', line 83
def expected_content_type
expected[:content_type]
end
|
#expected_error ⇒ Object
99
100
101
|
# File 'lib/webspicy/specification/test_case.rb', line 99
def expected_error
expected[:error]
end
|
107
108
109
|
# File 'lib/webspicy/specification/test_case.rb', line 107
def
expected[:headers] || {}
end
|
#expected_status ⇒ Object
87
88
89
|
# File 'lib/webspicy/specification/test_case.rb', line 87
def expected_status
expected[:status]
end
|
#file_upload ⇒ Object
71
72
73
|
# File 'lib/webspicy/specification/test_case.rb', line 71
def file_upload
@raw[:file_upload]
end
|
#has_assertions? ⇒ Boolean
119
120
121
|
# File 'lib/webspicy/specification/test_case.rb', line 119
def has_assertions?
!assert.empty?
end
|
#has_expected_error? ⇒ Boolean
103
104
105
|
# File 'lib/webspicy/specification/test_case.rb', line 103
def has_expected_error?
!expected_error.nil?
end
|
111
112
113
|
# File 'lib/webspicy/specification/test_case.rb', line 111
def
!.empty?
end
|
#has_expected_status? ⇒ Boolean
95
96
97
|
# File 'lib/webspicy/specification/test_case.rb', line 95
def has_expected_status?
not expected[:status].nil?
end
|
46
47
48
|
# File 'lib/webspicy/specification/test_case.rb', line 46
def
@raw[:headers] ||= {}
end
|
#is_expected_status?(status) ⇒ Boolean
91
92
93
|
# File 'lib/webspicy/specification/test_case.rb', line 91
def is_expected_status?(status)
expected_status === status
end
|
#located_file_upload ⇒ Object
75
76
77
|
# File 'lib/webspicy/specification/test_case.rb', line 75
def located_file_upload
file_upload ? file_upload.locate(specification) : nil
end
|
50
51
52
|
# File 'lib/webspicy/specification/test_case.rb', line 50
def metadata
@raw[:metadata] ||= {}
end
|
#mutate(override) ⇒ Object
123
124
125
126
127
|
# File 'lib/webspicy/specification/test_case.rb', line 123
def mutate(override)
m = self.dup
m.raw = self.raw.merge(override)
m
end
|
#params ⇒ Object
63
64
65
|
# File 'lib/webspicy/specification/test_case.rb', line 63
def params
@raw[:params] || {}
end
|
#seeds ⇒ Object
42
43
44
|
# File 'lib/webspicy/specification/test_case.rb', line 42
def seeds
@raw[:seeds]
end
|
#specification ⇒ Object
Also known as:
resource
27
28
29
|
# File 'lib/webspicy/specification/test_case.rb', line 27
def specification
service.specification
end
|
54
55
56
|
# File 'lib/webspicy/specification/test_case.rb', line 54
def tags
@raw[:tags] ||= []
end
|
#to_s ⇒ Object
129
130
131
|
# File 'lib/webspicy/specification/test_case.rb', line 129
def to_s
description
end
|