celerity 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/History.txt +10 -0
  2. data/README.txt +8 -11
  3. data/Rakefile +5 -3
  4. data/benchmark/bm_2000_spans.rb +48 -0
  5. data/benchmark/bm_digg.rb +26 -0
  6. data/benchmark/bm_google_images.rb +36 -0
  7. data/benchmark/bm_input_locator.rb +69 -0
  8. data/benchmark/loader.rb +9 -0
  9. data/lib/celerity.rb +3 -1
  10. data/lib/celerity/container.rb +23 -171
  11. data/lib/celerity/disabled_element.rb +1 -1
  12. data/lib/celerity/element.rb +78 -47
  13. data/lib/celerity/element_collections.rb +16 -32
  14. data/lib/celerity/element_locator.rb +135 -0
  15. data/lib/celerity/elements/button.rb +15 -0
  16. data/lib/celerity/elements/file_field.rb +1 -1
  17. data/lib/celerity/elements/form.rb +2 -1
  18. data/lib/celerity/elements/frame.rb +18 -21
  19. data/lib/celerity/elements/image.rb +2 -8
  20. data/lib/celerity/elements/label.rb +1 -3
  21. data/lib/celerity/elements/link.rb +1 -1
  22. data/lib/celerity/elements/option.rb +16 -0
  23. data/lib/celerity/elements/radio_check.rb +18 -7
  24. data/lib/celerity/elements/select_list.rb +1 -17
  25. data/lib/celerity/elements/table.rb +4 -4
  26. data/lib/celerity/elements/table_body.rb +6 -8
  27. data/lib/celerity/elements/table_cell.rb +3 -14
  28. data/lib/celerity/elements/table_row.rb +4 -10
  29. data/lib/celerity/elements/text_field.rb +16 -4
  30. data/lib/celerity/extra/method_generator.rb +144 -0
  31. data/lib/celerity/identifier.rb +10 -0
  32. data/lib/celerity/ie.rb +28 -13
  33. data/lib/celerity/input_element.rb +0 -4
  34. data/lib/celerity/non_control_elements.rb +12 -12
  35. data/lib/celerity/version.rb +1 -1
  36. data/spec/area_spec.rb +41 -41
  37. data/spec/areas_spec.rb +11 -11
  38. data/spec/button_spec.rb +73 -68
  39. data/spec/buttons_spec.rb +10 -10
  40. data/spec/checkbox_spec.rb +102 -96
  41. data/spec/checkboxes_spec.rb +10 -10
  42. data/spec/div_spec.rb +78 -73
  43. data/spec/divs_spec.rb +10 -10
  44. data/spec/element_spec.rb +20 -11
  45. data/spec/filefield_spec.rb +36 -41
  46. data/spec/filefields_spec.rb +10 -10
  47. data/spec/form_spec.rb +29 -29
  48. data/spec/forms_spec.rb +11 -11
  49. data/spec/frame_spec.rb +54 -49
  50. data/spec/hidden_spec.rb +43 -43
  51. data/spec/hiddens_spec.rb +10 -10
  52. data/spec/html/2000_spans.html +2009 -0
  53. data/spec/html/forms_with_input_elements.html +15 -9
  54. data/spec/html/non_control_elements.html +4 -2
  55. data/spec/ie_spec.rb +82 -48
  56. data/spec/image_spec.rb +83 -100
  57. data/spec/images_spec.rb +10 -10
  58. data/spec/label_spec.rb +29 -29
  59. data/spec/labels_spec.rb +10 -10
  60. data/spec/li_spec.rb +41 -41
  61. data/spec/link_spec.rb +65 -59
  62. data/spec/links_spec.rb +11 -11
  63. data/spec/lis_spec.rb +10 -10
  64. data/spec/map_spec.rb +30 -30
  65. data/spec/maps_spec.rb +10 -10
  66. data/spec/p_spec.rb +49 -49
  67. data/spec/pre_spec.rb +41 -41
  68. data/spec/pres_spec.rb +10 -10
  69. data/spec/ps_spec.rb +10 -10
  70. data/spec/radio_spec.rb +104 -97
  71. data/spec/radios_spec.rb +11 -11
  72. data/spec/select_list_spec.rb +118 -106
  73. data/spec/select_lists_spec.rb +15 -15
  74. data/spec/span_spec.rb +54 -54
  75. data/spec/spans_spec.rb +11 -11
  76. data/spec/spec.opts +1 -1
  77. data/spec/spec_helper.rb +23 -3
  78. data/spec/table_bodies.rb +8 -8
  79. data/spec/table_bodies_spec.rb +9 -9
  80. data/spec/table_body_spec.rb +28 -27
  81. data/spec/table_cell_spec.rb +25 -25
  82. data/spec/table_cells_spec.rb +16 -16
  83. data/spec/table_row_spec.rb +16 -16
  84. data/spec/table_rows_spec.rb +12 -12
  85. data/spec/table_spec.rb +36 -36
  86. data/spec/tables_spec.rb +12 -12
  87. data/spec/text_field_spec.rb +111 -92
  88. data/spec/text_fields_spec.rb +13 -13
  89. data/tasks/benchmark.rake +3 -0
  90. data/tasks/rspec.rake +2 -2
  91. data/tasks/testserver.rake +15 -0
  92. metadata +58 -46
  93. data/tasks/simple_ci.rake +0 -94
@@ -3,58 +3,58 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "TableCell" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie = IE.new
12
- @ie.goto(TEST_HOST + "/tables.html")
11
+ @browser = IE.new
12
+ @browser.goto(TEST_HOST + "/tables.html")
13
13
  end
14
14
 
15
15
  # Exists
16
16
  describe "#exists" do
17
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
18
+ @browser.cell(:id, 't1_r2_c1').should exist
19
+ @browser.cell(:id, /t1_r2_c1/).should exist
20
+ @browser.cell(:text, 'Table 1, Row 3, Cell 1').should exist
21
+ @browser.cell(:text, /Table 1/).should exist
22
+ @browser.cell(:index, 1).should exist
23
+ @browser.cell(:xpath, "//td[@id='t1_r2_c1']").should exist
24
24
  end
25
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
26
+ @browser.cell(:id, 'no_such_id').should_not exist
27
+ @browser.cell(:id, /no_such_id/).should_not exist
28
+ @browser.cell(:text, 'no_such_text').should_not exist
29
+ @browser.cell(:text, /no_such_text/).should_not exist
30
+ @browser.cell(:index, 1337).should_not exist
31
+ @browser.cell(:xpath, "//td[@id='no_such_id']").should_not exist
32
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)
33
+ it "should raise ArgumentError when 'what' argument is invalid" do
34
+ lambda { @browser.cell(:id, 3.14).exists? }.should raise_error(ArgumentError)
35
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)
36
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
37
+ lambda { @browser.cell(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
38
38
  end
39
39
  end
40
40
 
41
41
  # Attribute methods
42
42
  describe "#text" do
43
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'
44
+ @browser.cell(:id, 't1_r2_c1').text.should == 'Table 1, Row 2, Cell 1'
45
+ @browser.cell(:id, 't2_r1_c1').text.should == 'Table 2, Row 1, Cell 1'
46
46
  end
47
47
  end
48
48
 
49
49
  describe "#colspan" do
50
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
51
+ @browser.cell(:id, 'colspan_2').colspan.should == 2
52
+ @browser.cell(:id, 'no_colspan').colspan.should == 1
53
53
  end
54
54
  end
55
55
 
56
56
  after :all do
57
- @ie.close
57
+ @browser.close
58
58
  end
59
59
 
60
60
 
@@ -3,47 +3,47 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "TableCells" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie = IE.new
12
- @ie.goto(TEST_HOST + "/tables.html")
11
+ @browser = IE.new
12
+ @browser.goto(TEST_HOST + "/tables.html")
13
13
  end
14
14
 
15
15
  # describe "#length" do
16
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
17
+ # @browser.table(:id, 'outer').cells.length.should == 6
18
+ # @browser.table(:id, 'inner').cells.length.should == 2
19
19
  # end
20
20
  # end
21
21
  #
22
22
  # describe "#[]" do
23
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"
24
+ # @browser.table(:id, 'outer').cells[1].text.should == "Table 1, Row 1, Cell 1"
25
+ # @browser.table(:id, 'inner').cells[1].text.should == "Table 2, Row 1, Cell 1"
26
+ # @browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
27
27
  # end
28
28
  # end
29
29
 
30
30
  describe "#each" do
31
31
  it "should iterate through cells correctly" do
32
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
33
+ @browser.cells.each_with_index do |c, index|
34
+ c.name.should == @browser.cell(:index, index+1).name
35
+ c.id.should == @browser.cell(:index, index+1).id
36
+ c.value.should == @browser.cell(:index, index+1).value
37
37
  end
38
38
  # Cells inside a table
39
- inner_table = @ie.table(:id, 'inner')
39
+ inner_table = @browser.table(:id, 'inner')
40
40
  inner_table.cells.each_with_index do |c, index|
41
41
  c.name.should == inner_table.cell(:index, index+1).name
42
42
  c.id.should == inner_table.cell(:index, index+1).id
43
43
  c.value.should == inner_table.cell(:index, index+1).value
44
44
  end
45
45
  # Cells inside a table (should not include cells inside a table inside a table)
46
- outer_table = @ie.table(:id, 'outer')
46
+ outer_table = @browser.table(:id, 'outer')
47
47
  outer_table.cells.each_with_index do |c, index|
48
48
  c.name.should == outer_table.cell(:index, index+1).name
49
49
  c.id.should == outer_table.cell(:index, index+1).id
@@ -53,7 +53,7 @@ describe "TableCells" do
53
53
  end
54
54
 
55
55
  after :all do
56
- @ie.close
56
+ @browser.close
57
57
  end
58
58
 
59
59
  end
@@ -3,44 +3,44 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "TableRow" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie = IE.new
12
- @ie.goto(TEST_HOST + "/tables.html")
11
+ @browser = IE.new
12
+ @browser.goto(TEST_HOST + "/tables.html")
13
13
  end
14
14
 
15
15
  describe "#column_count" do
16
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
17
+ @browser.table(:id, 'outer').rows[1].column_count.should == 2
18
+ @browser.table(:id, 'outer')[2].column_count.should == 2
19
+ @browser.table(:id, 'colspan')[1].column_count.should == 1
20
+ @browser.table(:id, 'colspan').rows[2].column_count.should == 2
21
+ @browser.rows[1].column_count.should == 4
22
22
  end
23
23
  end
24
24
 
25
25
  describe "#length" do
26
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
27
+ @browser.table(:id, 'outer').rows.length.should == 3
28
+ @browser.table(:id, 'inner').rows.length.should == 1
29
29
  end
30
30
  end
31
31
 
32
32
  describe "#[]n" do
33
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"
34
+ @browser.table(:id, 'outer').row(:index, 1)[1].text.should == "Table 1, Row 1, Cell 1"
35
+ @browser.table(:id, 'outer')[1][1].text.should == "Table 1, Row 1, Cell 1"
36
+ @browser.table(:id, 'outer')[3][1].text.should == "Table 1, Row 3, Cell 1"
37
37
  end
38
38
  end
39
39
 
40
40
  describe "#each" do
41
41
  it "should " do
42
42
  index = 1
43
- @ie.table(:id, 'outer')[2].each do |c|
43
+ @browser.table(:id, 'outer')[2].each do |c|
44
44
  case index
45
45
  when 1
46
46
  c.text.should == "Table 1, Row 2, Cell 1"
@@ -53,7 +53,7 @@ describe "TableRow" do
53
53
  end
54
54
 
55
55
  after :all do
56
- @ie.close
56
+ @browser.close
57
57
  end
58
58
 
59
59
  end
@@ -3,45 +3,45 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "TableRows" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie = IE.new
12
- @ie.goto(TEST_HOST + "/tables.html")
11
+ @browser = IE.new
12
+ @browser.goto(TEST_HOST + "/tables.html")
13
13
  end
14
14
 
15
15
  describe "#length" do
16
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
17
+ @browser.table(:id, 'inner').rows.length.should == 1
18
+ @browser.table(:id, 'outer').rows.length.should == 3
19
19
  end
20
20
  it "should return the correct number of cells (page context)" do
21
- @ie.rows.length.should == 14
21
+ @browser.rows.length.should == 14
22
22
  end
23
23
  end
24
24
 
25
25
  describe "#[]" do
26
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"
27
+ @browser.table(:id, 'outer').rows[1].text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
28
28
  end
29
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"
30
+ @browser.rows[1].text.should == "Before income tax Income tax After income tax"
31
31
  end
32
32
  end
33
33
 
34
34
  describe "#each" do
35
35
  it "should iterate through rows correctly" do
36
36
  # rows inside a table
37
- inner_table = @ie.table(:id, 'inner')
37
+ inner_table = @browser.table(:id, 'inner')
38
38
  inner_table.rows.each_with_index do |r, index|
39
39
  r.name.should == inner_table.row(:index, index+1).name
40
40
  r.id.should == inner_table.row(:index, index+1).id
41
41
  r.value.should == inner_table.row(:index, index+1).value
42
42
  end
43
43
  # rows inside a table (should not include rows inside a table inside a table)
44
- outer_table = @ie.table(:id, 'outer')
44
+ outer_table = @browser.table(:id, 'outer')
45
45
  outer_table.rows.each_with_index do |r, index|
46
46
  r.name.should == outer_table.row(:index, index+1).name
47
47
  r.id.should == outer_table.row(:index, index+1).id
@@ -51,7 +51,7 @@ describe "TableRows" do
51
51
  end
52
52
 
53
53
  after :all do
54
- @ie.close
54
+ @browser.close
55
55
  end
56
56
 
57
57
  end
data/spec/table_spec.rb CHANGED
@@ -3,96 +3,96 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "Table" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie = IE.new
12
- @ie.goto(TEST_HOST + "/tables.html")
11
+ @browser = IE.new
12
+ @browser.goto(TEST_HOST + "/tables.html")
13
13
  end
14
14
 
15
15
  # Exists
16
16
  describe "#exists?" do
17
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
18
+ @browser.table(:id, 'axis_example').should exist
19
+ @browser.table(:id, /axis_example/).should exist
20
+ @browser.table(:index, 1).should exist
21
+ @browser.table(:xpath, "//table[@id='axis_example']").should exist
22
22
  end
23
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
24
+ @browser.table(:id, 'no_such_id').should_not exist
25
+ @browser.table(:id, /no_such_id/).should_not exist
26
+ @browser.table(:index, 1337).should_not exist
27
+ @browser.table(:xpath, "//table[@id='no_such_id']").should_not exist
28
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)
29
+ it "should raise ArgumentError when 'what' argument is invalid" do
30
+ lambda { @browser.table(:id, 3.14).exists? }.should raise_error(ArgumentError)
31
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)
32
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
33
+ lambda { @browser.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
34
34
  end
35
35
  end
36
36
 
37
37
  # Other
38
38
  describe "#to_a" do
39
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"]]
40
+ @browser.table(:id, 'inner').to_a.should == [["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]]
41
41
  end
42
42
  end
43
43
 
44
44
  describe "#row_count" do
45
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
46
+ @browser.table(:id, 'inner').row_count.should == 1
47
+ @browser.table(:id, 'outer').row_count.should == 3
48
48
  end
49
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)
50
+ lambda { @browser.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
51
+ lambda { @browser.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
52
52
  end
53
53
  end
54
54
 
55
55
  describe "#row_values" do
56
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"]
57
+ @browser.table(:id, 'outer').row_values(1).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
58
+ @browser.table(:id, 'inner').row_values(1).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
59
+ @browser.table(:id, 'outer').row_values(3).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
60
60
  end
61
61
  end
62
62
 
63
63
  describe "#column_count" do
64
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
65
+ @browser.table(:id, 'inner').column_count.should == 2
66
+ @browser.table(:id, 'outer').column_count.should == 2
67
67
  end
68
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)
69
+ lambda { @browser.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
70
+ lambda { @browser.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
71
71
  end
72
72
  end
73
73
 
74
74
  describe "#column_values" do
75
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"]
76
+ @browser.table(:id, 'inner').column_values(1).should == ["Table 2, Row 1, Cell 1"]
77
+ @browser.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
78
  end
79
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)
80
+ lambda { @browser.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
81
81
  end
82
82
  end
83
83
 
84
84
  describe "#[]" do
85
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"
86
+ @browser.table(:id, 'outer')[1].id.should == "outer_first"
87
+ @browser.table(:id, 'inner')[1].id.should == "inner_first"
88
+ @browser.table(:id, 'outer')[3].id.should == "outer_last"
89
89
  end
90
90
  end
91
91
 
92
92
  describe "#each" do
93
93
  it "should iterate through the table's rows" do
94
94
  index = 1
95
- @ie.table(:id, 'outer').each do |r|
95
+ @browser.table(:id, 'outer').each do |r|
96
96
  case index
97
97
  when 1
98
98
  r.text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
@@ -105,7 +105,7 @@ describe "Table" do
105
105
  end
106
106
 
107
107
  after :all do
108
- @ie.close
108
+ @browser.close
109
109
  end
110
110
 
111
111
  end
data/spec/tables_spec.rb CHANGED
@@ -2,40 +2,40 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe "Tables" do
4
4
  before :all do
5
- @ie = IE.new
6
- add_spec_checker(@ie)
5
+ @browser = IE.new
6
+ add_spec_checker(@browser)
7
7
  end
8
8
 
9
9
  before :each do
10
- @ie.goto(TEST_HOST + "/tables.html")
10
+ @browser.goto(TEST_HOST + "/tables.html")
11
11
  end
12
12
 
13
13
  describe "#length" do
14
14
  it "should return the number of tables" do
15
- @ie.tables.length.should == 4
15
+ @browser.tables.length.should == 4
16
16
  end
17
17
  end
18
18
 
19
19
  describe "#[]" do
20
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"
21
+ @browser.tables[1].id.should == "axis_example"
22
+ @browser.tables[2].id.should == "outer"
23
+ @browser.tables[3].id.should == "inner"
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#each" do
28
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
29
+ @browser.tables.each_with_index do |t, index|
30
+ t.name.should == @browser.table(:index, index+1).name
31
+ t.id.should == @browser.table(:index, index+1).id
32
+ t.value.should == @browser.table(:index, index+1).value
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
37
  after :all do
38
- @ie.close
38
+ @browser.close
39
39
  end
40
40
 
41
41
  end