celerity 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/History.txt +4 -0
  2. data/License.txt +621 -0
  3. data/README.txt +58 -0
  4. data/Rakefile +4 -0
  5. data/lib/celerity.rb +47 -0
  6. data/lib/celerity/clickable_element.rb +11 -0
  7. data/lib/celerity/collections.rb +99 -0
  8. data/lib/celerity/container.rb +369 -0
  9. data/lib/celerity/disabled_element.rb +20 -0
  10. data/lib/celerity/element.rb +114 -0
  11. data/lib/celerity/element_collections.rb +67 -0
  12. data/lib/celerity/elements/button.rb +13 -0
  13. data/lib/celerity/elements/file_field.rb +12 -0
  14. data/lib/celerity/elements/form.rb +15 -0
  15. data/lib/celerity/elements/frame.rb +44 -0
  16. data/lib/celerity/elements/image.rb +70 -0
  17. data/lib/celerity/elements/label.rb +10 -0
  18. data/lib/celerity/elements/link.rb +13 -0
  19. data/lib/celerity/elements/radio_check.rb +59 -0
  20. data/lib/celerity/elements/select_list.rb +84 -0
  21. data/lib/celerity/elements/table.rb +94 -0
  22. data/lib/celerity/elements/table_body.rb +38 -0
  23. data/lib/celerity/elements/table_cell.rb +30 -0
  24. data/lib/celerity/elements/table_row.rb +34 -0
  25. data/lib/celerity/elements/text_field.rb +80 -0
  26. data/lib/celerity/exception.rb +48 -0
  27. data/lib/celerity/htmlunit/commons-codec-1.3.jar +0 -0
  28. data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
  29. data/lib/celerity/htmlunit/commons-httpclient-3.1.jar +0 -0
  30. data/lib/celerity/htmlunit/commons-io-1.4.jar +0 -0
  31. data/lib/celerity/htmlunit/commons-lang-2.4.jar +0 -0
  32. data/lib/celerity/htmlunit/commons-logging-1.1.1.jar +0 -0
  33. data/lib/celerity/htmlunit/cssparser-0.9.5.jar +0 -0
  34. data/lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar +0 -0
  35. data/lib/celerity/htmlunit/js-1.7R1.jar +0 -0
  36. data/lib/celerity/htmlunit/nekohtml-1.9.7.jar +0 -0
  37. data/lib/celerity/htmlunit/sac-1.3.jar +0 -0
  38. data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
  39. data/lib/celerity/htmlunit/xercesImpl-2.8.1.jar +0 -0
  40. data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
  41. data/lib/celerity/ie.rb +126 -0
  42. data/lib/celerity/input_element.rb +29 -0
  43. data/lib/celerity/non_control_elements.rb +50 -0
  44. data/lib/celerity/version.rb +9 -0
  45. data/setup.rb +1585 -0
  46. data/spec/area_spec.rb +79 -0
  47. data/spec/areas_spec.rb +41 -0
  48. data/spec/button_spec.rb +171 -0
  49. data/spec/buttons_spec.rb +40 -0
  50. data/spec/checkbox_spec.rb +259 -0
  51. data/spec/checkboxes_spec.rb +39 -0
  52. data/spec/div_spec.rb +174 -0
  53. data/spec/divs_spec.rb +40 -0
  54. data/spec/element_spec.rb +29 -0
  55. data/spec/filefield_spec.rb +110 -0
  56. data/spec/filefields_spec.rb +41 -0
  57. data/spec/form_spec.rb +53 -0
  58. data/spec/forms_spec.rb +42 -0
  59. data/spec/frame_spec.rb +103 -0
  60. data/spec/hidden_spec.rb +105 -0
  61. data/spec/hiddens_spec.rb +40 -0
  62. data/spec/html/forms_with_input_elements.html +107 -0
  63. data/spec/html/frame_1.html +17 -0
  64. data/spec/html/frame_2.html +16 -0
  65. data/spec/html/frames.html +11 -0
  66. data/spec/html/iframes.html +12 -0
  67. data/spec/html/images.html +24 -0
  68. data/spec/html/images/1.gif +0 -0
  69. data/spec/html/images/2.gif +0 -0
  70. data/spec/html/images/3.gif +0 -0
  71. data/spec/html/images/button.jpg +0 -0
  72. data/spec/html/images/circle.jpg +0 -0
  73. data/spec/html/images/map.gif +0 -0
  74. data/spec/html/images/map2.gif +0 -0
  75. data/spec/html/images/minus.gif +0 -0
  76. data/spec/html/images/originaltriangle.jpg +0 -0
  77. data/spec/html/images/plus.gif +0 -0
  78. data/spec/html/images/square.jpg +0 -0
  79. data/spec/html/images/triangle.jpg +0 -0
  80. data/spec/html/non_control_elements.html +85 -0
  81. data/spec/html/tables.html +119 -0
  82. data/spec/ie_spec.rb +146 -0
  83. data/spec/image_spec.rb +210 -0
  84. data/spec/images_spec.rb +39 -0
  85. data/spec/label_spec.rb +65 -0
  86. data/spec/labels_spec.rb +41 -0
  87. data/spec/li_spec.rb +114 -0
  88. data/spec/link_spec.rb +147 -0
  89. data/spec/links_spec.rb +43 -0
  90. data/spec/lis_spec.rb +40 -0
  91. data/spec/map_spec.rb +83 -0
  92. data/spec/maps_spec.rb +41 -0
  93. data/spec/p_spec.rb +140 -0
  94. data/spec/pre_spec.rb +110 -0
  95. data/spec/pres_spec.rb +41 -0
  96. data/spec/ps_spec.rb +40 -0
  97. data/spec/radio_spec.rb +260 -0
  98. data/spec/radios_spec.rb +43 -0
  99. data/spec/select_list_spec.rb +286 -0
  100. data/spec/select_lists_spec.rb +47 -0
  101. data/spec/span_spec.rb +156 -0
  102. data/spec/spans_spec.rb +65 -0
  103. data/spec/spec.opts +1 -0
  104. data/spec/spec_helper.rb +90 -0
  105. data/spec/table_bodies.rb +40 -0
  106. data/spec/table_bodies_spec.rb +42 -0
  107. data/spec/table_body_spec.rb +72 -0
  108. data/spec/table_cell_spec.rb +61 -0
  109. data/spec/table_cells_spec.rb +60 -0
  110. data/spec/table_row_spec.rb +59 -0
  111. data/spec/table_rows_spec.rb +57 -0
  112. data/spec/table_spec.rb +111 -0
  113. data/spec/tables_spec.rb +42 -0
  114. data/spec/text_field_spec.rb +234 -0
  115. data/spec/text_fields_spec.rb +45 -0
  116. data/tasks/environment.rake +7 -0
  117. data/tasks/rspec.rake +23 -0
  118. data/tasks/simple_ci.rake +94 -0
  119. data/tasks/testserver.rake +17 -0
  120. metadata +174 -0
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "TableBody" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ describe "#exists" do
16
+ it "should return true if the table body exists" do
17
+ @ie.table(:index, 1).body(:id, 'first').should exist
18
+ @ie.table(:index, 1).body(:id, /first/).should exist
19
+ @ie.table(:index, 1).body(:name, 'second').should exist
20
+ @ie.table(:index, 1).body(:name, /second/).should exist
21
+ @ie.table(:index, 1).body(:index, 1).should exist
22
+ @ie.table(:index, 1).body(:xpath, "//tbody[@id='first']").should exist
23
+ end
24
+ it "should return false if the table body exists" do
25
+ @ie.table(:index, 1).body(:id, 'no_such_id').should_not exist
26
+ @ie.table(:index, 1).body(:id, /no_such_id/).should_not exist
27
+ @ie.table(:index, 1).body(:name, 'no_such_name').should_not exist
28
+ @ie.table(:index, 1).body(:name, /no_such_name/).should_not exist
29
+ @ie.table(:index, 1).body(:index, 1337).should_not exist
30
+ @ie.table(:index, 1).body(:xpath, "//tbody[@id='no_such_id']").should_not exist
31
+ end
32
+ it "should raise ArgumentError when what argument is invalid" do
33
+ lambda { @ie.table(:index, 1).body(:id, 3.14).exists? }.should raise_error(ArgumentError)
34
+ end
35
+ it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
36
+ lambda { @ie.table(:index, 1).body(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
37
+ end
38
+ end
39
+
40
+ describe "#length" do
41
+ it "should return the correct number of table bodies" do
42
+ @ie.table(:index, 1).body(:id, 'first').length.should == 3
43
+ @ie.table(:index, 1).body(:name, 'second').length.should == 3
44
+ end
45
+ end
46
+
47
+ describe "#[]" do
48
+ it "should return the row at the given index" do
49
+ @ie.table(:index, 1).body(:id, 'first')[1].text.should == 'March 2008'
50
+ @ie.table(:index, 1).body(:id, 'first')[2][1].text.should == 'Gregory House'
51
+ @ie.table(:index, 1).body(:id, 'first')[3][1].text.should == 'Hugh Laurie'
52
+ end
53
+ end
54
+
55
+ describe "#each" do
56
+ it "should iterate through rows correctly" do
57
+ body = @ie.table(:index, 1).body(:id, 'first')
58
+ index = 1
59
+ body.each do |r|
60
+ r.name.should == body.row(:index, index).name
61
+ r.id.should == body.row(:index, index).id
62
+ r.value.should == body.row(:index, index).value
63
+ index += 1
64
+ end
65
+ end
66
+ end
67
+
68
+ after :all do
69
+ @ie.close
70
+ end
71
+
72
+ end
@@ -0,0 +1,61 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "TableCell" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ # Exists
16
+ describe "#exists" do
17
+ it "should return true when the table cell exists" do
18
+ @ie.cell(:id, 't1_r2_c1').should exist
19
+ @ie.cell(:id, /t1_r2_c1/).should exist
20
+ @ie.cell(:text, 'Table 1, Row 3, Cell 1').should exist
21
+ @ie.cell(:text, /Table 1/).should exist
22
+ @ie.cell(:index, 1).should exist
23
+ @ie.cell(:xpath, "//td[@id='t1_r2_c1']").should exist
24
+ end
25
+ it "should return false when the table cell does not exist" do
26
+ @ie.cell(:id, 'no_such_id').should_not exist
27
+ @ie.cell(:id, /no_such_id/).should_not exist
28
+ @ie.cell(:text, 'no_such_text').should_not exist
29
+ @ie.cell(:text, /no_such_text/).should_not exist
30
+ @ie.cell(:index, 1337).should_not exist
31
+ @ie.cell(:xpath, "//td[@id='no_such_id']").should_not exist
32
+ end
33
+ it "should raise ArgumentError when what argument is invalid" do
34
+ lambda { @ie.cell(:id, 3.14).exists? }.should raise_error(ArgumentError)
35
+ end
36
+ it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
37
+ lambda { @ie.cell(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
38
+ end
39
+ end
40
+
41
+ # Attribute methods
42
+ describe "#text" do
43
+ it "should return the text inside the table cell" do
44
+ @ie.cell(:id, 't1_r2_c1').text.should == 'Table 1, Row 2, Cell 1'
45
+ @ie.cell(:id, 't2_r1_c1').text.should == 'Table 2, Row 1, Cell 1'
46
+ end
47
+ end
48
+
49
+ describe "#colspan" do
50
+ it "should get the colspan attribute" do
51
+ @ie.cell(:id, 'colspan_2').colspan.should == 2
52
+ @ie.cell(:id, 'no_colspan').colspan.should == 1
53
+ end
54
+ end
55
+
56
+ after :all do
57
+ @ie.close
58
+ end
59
+
60
+
61
+ end
@@ -0,0 +1,60 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "TableCells" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ # describe "#length" do
16
+ # it "should return the number of cells" do
17
+ # @ie.table(:id, 'outer').cells.length.should == 6
18
+ # @ie.table(:id, 'inner').cells.length.should == 2
19
+ # end
20
+ # end
21
+ #
22
+ # describe "#[]" do
23
+ # it "should return the row at the given index" do
24
+ # @ie.table(:id, 'outer').cells[1].text.should == "Table 1, Row 1, Cell 1"
25
+ # @ie.table(:id, 'inner').cells[1].text.should == "Table 2, Row 1, Cell 1"
26
+ # @ie.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
27
+ # end
28
+ # end
29
+
30
+ describe "#each" do
31
+ it "should iterate through cells correctly" do
32
+ # All cells on the page
33
+ @ie.cells.each_with_index do |c, index|
34
+ c.name.should == @ie.cell(:index, index+1).name
35
+ c.id.should == @ie.cell(:index, index+1).id
36
+ c.value.should == @ie.cell(:index, index+1).value
37
+ end
38
+ # Cells inside a table
39
+ inner_table = @ie.table(:id, 'inner')
40
+ inner_table.cells.each_with_index do |c, index|
41
+ c.name.should == inner_table.cell(:index, index+1).name
42
+ c.id.should == inner_table.cell(:index, index+1).id
43
+ c.value.should == inner_table.cell(:index, index+1).value
44
+ end
45
+ # Cells inside a table (should not include cells inside a table inside a table)
46
+ outer_table = @ie.table(:id, 'outer')
47
+ outer_table.cells.each_with_index do |c, index|
48
+ c.name.should == outer_table.cell(:index, index+1).name
49
+ c.id.should == outer_table.cell(:index, index+1).id
50
+ c.value.should == outer_table.cell(:index, index+1).value
51
+ end
52
+ end
53
+ end
54
+
55
+ after :all do
56
+ @ie.close
57
+ end
58
+
59
+ end
60
+
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "TableRow" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ describe "#column_count" do
16
+ it "should return the number of columns (cells) in the row" do
17
+ @ie.table(:id, 'outer').rows[1].column_count.should == 2
18
+ @ie.table(:id, 'outer')[2].column_count.should == 2
19
+ @ie.table(:id, 'colspan')[1].column_count.should == 1
20
+ @ie.table(:id, 'colspan').rows[2].column_count.should == 2
21
+ @ie.rows[1].column_count.should == 4
22
+ end
23
+ end
24
+
25
+ describe "#length" do
26
+ it "should return the number of rows" do
27
+ @ie.table(:id, 'outer').rows.length.should == 3
28
+ @ie.table(:id, 'inner').rows.length.should == 1
29
+ end
30
+ end
31
+
32
+ describe "#[]n" do
33
+ it "should " do
34
+ @ie.table(:id, 'outer').row(:index, 1)[1].text.should == "Table 1, Row 1, Cell 1"
35
+ @ie.table(:id, 'outer')[1][1].text.should == "Table 1, Row 1, Cell 1"
36
+ @ie.table(:id, 'outer')[3][1].text.should == "Table 1, Row 3, Cell 1"
37
+ end
38
+ end
39
+
40
+ describe "#each" do
41
+ it "should " do
42
+ index = 1
43
+ @ie.table(:id, 'outer')[2].each do |c|
44
+ case index
45
+ when 1
46
+ c.text.should == "Table 1, Row 2, Cell 1"
47
+ when 2
48
+ c.text.should == "Table 1, Row 2, Cell 2 Table 2, Row 1, Cell 1 Table 2, Row 1, Cell 2"
49
+ end
50
+ index += 1
51
+ end
52
+ end
53
+ end
54
+
55
+ after :all do
56
+ @ie.close
57
+ end
58
+
59
+ end
@@ -0,0 +1,57 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "TableRows" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ describe "#length" do
16
+ it "should return the correct number of cells (table context)" do
17
+ @ie.table(:id, 'inner').rows.length.should == 1
18
+ @ie.table(:id, 'outer').rows.length.should == 3
19
+ end
20
+ it "should return the correct number of cells (page context)" do
21
+ @ie.rows.length.should == 14
22
+ end
23
+ end
24
+
25
+ describe "#[]" do
26
+ it "should return the row at the given index (table context)" do
27
+ @ie.table(:id, 'outer').rows[1].text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
28
+ end
29
+ it "should return the row at the given index (page context)" do
30
+ @ie.rows[1].text.should == "Before income tax Income tax After income tax"
31
+ end
32
+ end
33
+
34
+ describe "#each" do
35
+ it "should iterate through rows correctly" do
36
+ # rows inside a table
37
+ inner_table = @ie.table(:id, 'inner')
38
+ inner_table.rows.each_with_index do |r, index|
39
+ r.name.should == inner_table.row(:index, index+1).name
40
+ r.id.should == inner_table.row(:index, index+1).id
41
+ r.value.should == inner_table.row(:index, index+1).value
42
+ end
43
+ # rows inside a table (should not include rows inside a table inside a table)
44
+ outer_table = @ie.table(:id, 'outer')
45
+ outer_table.rows.each_with_index do |r, index|
46
+ r.name.should == outer_table.row(:index, index+1).name
47
+ r.id.should == outer_table.row(:index, index+1).id
48
+ r.value.should == outer_table.row(:index, index+1).value
49
+ end
50
+ end
51
+ end
52
+
53
+ after :all do
54
+ @ie.close
55
+ end
56
+
57
+ end
@@ -0,0 +1,111 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Table" do
4
+
5
+ before :all do
6
+ @ie = IE.new
7
+ add_spec_checker(@ie)
8
+ end
9
+
10
+ before :each do
11
+ @ie = IE.new
12
+ @ie.goto(TEST_HOST + "/tables.html")
13
+ end
14
+
15
+ # Exists
16
+ describe "#exists?" do
17
+ it "should return true if the table exists" do
18
+ @ie.table(:id, 'axis_example').should exist
19
+ @ie.table(:id, /axis_example/).should exist
20
+ @ie.table(:index, 1).should exist
21
+ @ie.table(:xpath, "//table[@id='axis_example']").should exist
22
+ end
23
+ it "should return false if the table does not exist" do
24
+ @ie.table(:id, 'no_such_id').should_not exist
25
+ @ie.table(:id, /no_such_id/).should_not exist
26
+ @ie.table(:index, 1337).should_not exist
27
+ @ie.table(:xpath, "//table[@id='no_such_id']").should_not exist
28
+ end
29
+ it "should raise ArgumentError when what argument is invalid" do
30
+ lambda { @ie.table(:id, 3.14).exists? }.should raise_error(ArgumentError)
31
+ end
32
+ it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
33
+ lambda { @ie.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
34
+ end
35
+ end
36
+
37
+ # Other
38
+ describe "#to_a" do
39
+ it "should return a two-dimensional array representation of the table" do
40
+ @ie.table(:id, 'inner').to_a.should == [["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]]
41
+ end
42
+ end
43
+
44
+ describe "#row_count" do
45
+ it "should count the number of rows correctly" do
46
+ @ie.table(:id, 'inner').row_count.should == 1
47
+ @ie.table(:id, 'outer').row_count.should == 3
48
+ end
49
+ it "should raise an UnknownObjectException if the table doesn't exist" do
50
+ lambda { @ie.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
51
+ lambda { @ie.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
52
+ end
53
+ end
54
+
55
+ describe "#row_values" do
56
+ it "should get row values" do
57
+ @ie.table(:id, 'outer').row_values(1).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
58
+ @ie.table(:id, 'inner').row_values(1).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
59
+ @ie.table(:id, 'outer').row_values(3).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
60
+ end
61
+ end
62
+
63
+ describe "#column_count" do
64
+ it "should count the number of columns correctly" do
65
+ @ie.table(:id, 'inner').column_count.should == 2
66
+ @ie.table(:id, 'outer').column_count.should == 2
67
+ end
68
+ it "should raise an UnknownObjectException if the table doesn't exist" do
69
+ lambda { @ie.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
70
+ lambda { @ie.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
71
+ end
72
+ end
73
+
74
+ describe "#column_values" do
75
+ it "should get column values" do
76
+ @ie.table(:id, 'inner').column_values(1).should == ["Table 2, Row 1, Cell 1"]
77
+ @ie.table(:id, 'outer').column_values(1).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 2, Cell 1", "Table 1, Row 3, Cell 1"]
78
+ end
79
+ it "should raise UnknownCellException when trying to locate non-existing cell" do
80
+ lambda { @ie.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
81
+ end
82
+ end
83
+
84
+ describe "#[]" do
85
+ it "should return the row at the given index" do
86
+ @ie.table(:id, 'outer')[1].id.should == "outer_first"
87
+ @ie.table(:id, 'inner')[1].id.should == "inner_first"
88
+ @ie.table(:id, 'outer')[3].id.should == "outer_last"
89
+ end
90
+ end
91
+
92
+ describe "#each" do
93
+ it "should iterate through the table's rows" do
94
+ index = 1
95
+ @ie.table(:id, 'outer').each do |r|
96
+ case index
97
+ when 1
98
+ r.text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
99
+ when 3
100
+ r.text.should == "Table 1, Row 3, Cell 1 Table 1, Row 3, Cell 2"
101
+ end
102
+ index += 1
103
+ end
104
+ end
105
+ end
106
+
107
+ after :all do
108
+ @ie.close
109
+ end
110
+
111
+ end
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Tables" do
4
+ before :all do
5
+ @ie = IE.new
6
+ add_spec_checker(@ie)
7
+ end
8
+
9
+ before :each do
10
+ @ie.goto(TEST_HOST + "/tables.html")
11
+ end
12
+
13
+ describe "#length" do
14
+ it "should return the number of tables" do
15
+ @ie.tables.length.should == 4
16
+ end
17
+ end
18
+
19
+ describe "#[]" do
20
+ it "should return the p at the given index" do
21
+ @ie.tables[1].id.should == "axis_example"
22
+ @ie.tables[2].id.should == "outer"
23
+ @ie.tables[3].id.should == "inner"
24
+ end
25
+ end
26
+
27
+ describe "#each" do
28
+ it "should iterate through tables correctly" do
29
+ @ie.tables.each_with_index do |t, index|
30
+ t.name.should == @ie.table(:index, index+1).name
31
+ t.id.should == @ie.table(:index, index+1).id
32
+ t.value.should == @ie.table(:index, index+1).value
33
+ end
34
+ end
35
+ end
36
+
37
+ after :all do
38
+ @ie.close
39
+ end
40
+
41
+ end
42
+