|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
1 |
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") |
| |
2 |
|
|
db0488c0
»
|
brynary |
2008-11-23 |
Updating usages of "selects... |
3 |
describe "select_date" do |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
4 |
it "should send the values for each individual date component" do |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
5 |
with_html <<-HTML |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
6 |
<html> |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
7 |
<form action="/appointments" method="post"> |
| |
8 |
<label for="appointment_date">Date</label><br /> |
| |
9 |
<select id="appointment_date_1i" name="appointment[date(1i)]"> |
| |
10 |
<option value="2003">2003</option> |
| |
11 |
</select> |
| |
12 |
<select id="appointment_date_2i" name="appointment[date(2i)]"> |
| |
13 |
<option value="12">December</option> |
| |
14 |
</select> |
| |
15 |
<select id="appointment_date_3i" name="appointment[date(3i)]"> |
| |
16 |
<option value="25">25</option> |
| |
17 |
</select> |
| |
18 |
<input type="submit" /> |
| |
19 |
</form> |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
20 |
</html> |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
21 |
HTML |
| |
22 |
webrat_session.should_receive(:post).with("/appointments", |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
23 |
"appointment" => {"date(1i)" => '2003', "date(2i)" => "12", "date(3i)" => "25"}) |
|
db0488c0
»
|
brynary |
2008-11-23 |
Updating usages of "selects... |
24 |
select_date "December 25, 2003", :from => "Date" |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
25 |
click_button |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
26 |
end |
| |
27 |
|
| |
28 |
it "should accept a date object" do |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
29 |
with_html <<-HTML |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
30 |
<html> |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
31 |
<form action="/appointments" method="post"> |
| |
32 |
<label for="appointment_date">date</label><br /> |
| |
33 |
<select id="appointment_date_1i" name="appointment[date(1i)]"> |
| |
34 |
<option value="2003">2003</option> |
| |
35 |
</select> |
| |
36 |
<select id="appointment_date_2i" name="appointment[date(2i)]"> |
| |
37 |
<option value="12">December</option> |
| |
38 |
</select> |
| |
39 |
<select id="appointment_date_3i" name="appointment[date(3i)]"> |
| |
40 |
<option value="25">25</option> |
| |
41 |
</select> |
| |
42 |
<input type="submit" /> |
| |
43 |
</form> |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
44 |
</html> |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
45 |
HTML |
| |
46 |
webrat_session.should_receive(:post).with("/appointments", |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
47 |
"appointment" => {"date(1i)" => '2003', "date(2i)" => "12", "date(3i)" => "25"}) |
|
db0488c0
»
|
brynary |
2008-11-23 |
Updating usages of "selects... |
48 |
select_date Date.parse("December 25, 2003"), :from => "date" |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
49 |
click_button |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
50 |
end |
| |
51 |
|
| |
52 |
it "should work when no label is specified" do |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
53 |
with_html <<-HTML |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
54 |
<html> |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
55 |
<form action="/appointments" method="post"> |
| |
56 |
<select id="appointment_date_1i" name="appointment[date(1i)]"> |
| |
57 |
<option value="2003">2003</option> |
| |
58 |
</select> |
| |
59 |
<select id="appointment_date_2i" name="appointment[date(2i)]"> |
| |
60 |
<option value="12">December</option> |
| |
61 |
</select> |
| |
62 |
<select id="appointment_date_3i" name="appointment[date(3i)]"> |
| |
63 |
<option value="25">25</option> |
| |
64 |
</select> |
| |
65 |
<input type="submit" /> |
| |
66 |
</form> |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
67 |
</html> |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
68 |
HTML |
| |
69 |
webrat_session.should_receive(:post).with("/appointments", |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
70 |
"appointment" => {"date(1i)" => '2003', "date(2i)" => "12", "date(3i)" => "25"}) |
|
db0488c0
»
|
brynary |
2008-11-23 |
Updating usages of "selects... |
71 |
select_date "December 25, 2003" |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
72 |
click_button |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
73 |
end |
| |
74 |
|
| |
75 |
it "should fail if the specified label is not found" do |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
76 |
with_html <<-HTML |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
77 |
<html> |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
78 |
<form method="post" action="/appointments"> |
| |
79 |
<select name="month"><option>January</option></select> |
| |
80 |
<input type="submit" /> |
| |
81 |
</form> |
|
31aa659a
»
|
brynary |
2008-11-27 |
Ensure all example HTML is ... |
82 |
</html> |
|
f03905e6
»
|
brynary |
2008-11-22 |
Use Webrat::Methods in specs |
83 |
HTML |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
84 |
|
|
48e43a25
»
|
brynary |
2008-11-23 |
Always raise Webrat::Webrat... |
85 |
lambda { select_date "December 25, 2003", :from => "date" }.should raise_error(Webrat::NotFoundError) |
|
6cd76fa0
»
|
bmabey |
2008-11-13 |
selects_time, selects_date,... |
86 |
end |
| |
87 |
|
| |
88 |
end |