Class: PencilPusher::HaveTextField
- Inherits:
-
Object
- Object
- PencilPusher::HaveTextField
show all
- Includes:
- Matchers
- Defined in:
- lib/pencil_pusher/have_text_field.rb
Instance Method Summary
collapse
Methods included from Matchers
#have_errors, #have_int_field, #have_required_choice_field, #have_required_field, #have_required_float_field, #have_required_int_field, #have_required_text_field, #have_text_field
Constructor Details
#initialize(field_name, valid_value) ⇒ HaveTextField
Returns a new instance of HaveTextField.
5
6
7
8
|
# File 'lib/pencil_pusher/have_text_field.rb', line 5
def initialize(field_name, valid_value)
@field_name = field_name
@valid_value = valid_value
end
|
Instance Method Details
#description ⇒ Object
31
32
33
|
# File 'lib/pencil_pusher/have_text_field.rb', line 31
def description
"have text field #{field_name}"
end
|
#failure_message_for_should(actual, two) ⇒ Object
Also known as:
failure_message
20
21
22
|
# File 'lib/pencil_pusher/have_text_field.rb', line 20
def failure_message_for_should(actual, two)
@error
end
|
#failure_message_for_should_not(actual) ⇒ Object
Also known as:
failure_message_when_negated
24
25
26
|
# File 'lib/pencil_pusher/have_text_field.rb', line 24
def failure_message_for_should_not(actual)
"expected #{actual} to not have text field #{field_name} but did"
end
|
#matches?(builder) ⇒ Boolean
10
11
12
13
14
15
16
17
18
|
# File 'lib/pencil_pusher/have_text_field.rb', line 10
def matches?(builder)
begin
FormBuilder.form(builder, field_name => valid_value).should_not have_errors(field_name)
rescue => e
@error = e.message
raise e
end
true
end
|