symbiont 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile.lock +22 -7
  2. data/HISTORY.md +6 -0
  3. data/app/public/css/site.css +16 -0
  4. data/app/public/js/site.js +3 -1
  5. data/app/views/comics.erb +23 -1
  6. data/app/views/webobject.erb +1 -1
  7. data/lib/symbiont/data_setter.rb +7 -3
  8. data/lib/symbiont/enclosers.rb +24 -27
  9. data/lib/symbiont/evaluators.rb +52 -23
  10. data/lib/symbiont/factory.rb +19 -75
  11. data/lib/symbiont/generators.rb +172 -44
  12. data/lib/symbiont/platform_watir/platform_object.rb +202 -18
  13. data/lib/symbiont/version.rb +1 -1
  14. data/lib/symbiont/web_objects/button.rb +1 -1
  15. data/lib/symbiont/web_objects/checkbox.rb +1 -1
  16. data/lib/symbiont/web_objects/heading.rb +12 -0
  17. data/lib/symbiont/web_objects/hidden_field.rb +19 -0
  18. data/lib/symbiont/web_objects/label.rb +15 -0
  19. data/lib/symbiont/web_objects/list_item.rb +13 -0
  20. data/lib/symbiont/web_objects/ordered_list.rb +49 -0
  21. data/lib/symbiont/web_objects/radio.rb +1 -1
  22. data/lib/symbiont/web_objects/select_list.rb +1 -1
  23. data/lib/symbiont/web_objects/table.rb +4 -0
  24. data/lib/symbiont/web_objects/table_row.rb +4 -0
  25. data/lib/symbiont/web_objects/text_area.rb +26 -0
  26. data/lib/symbiont/web_objects/unordered_list.rb +49 -0
  27. data/lib/symbiont.rb +7 -0
  28. data/lucid.yml +6 -0
  29. data/spec/spec_helper.rb +70 -16
  30. data/spec/symbiont/data_setter_spec.rb +65 -62
  31. data/spec/symbiont/enclosers_spec.rb +76 -57
  32. data/spec/symbiont/evaluators_spec.rb +95 -75
  33. data/spec/symbiont/factory_spec.rb +174 -122
  34. data/spec/symbiont/generators/button_generators_spec.rb +34 -31
  35. data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
  36. data/spec/symbiont/generators/div_generators_spec.rb +56 -52
  37. data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
  38. data/spec/symbiont/generators/link_generators_spec.rb +30 -27
  39. data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
  40. data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
  41. data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
  42. data/spec/symbiont/generators/span_generators_spec.rb +56 -52
  43. data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
  44. data/spec/symbiont/generators/table_generators_spec.rb +56 -52
  45. data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
  46. data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
  47. data/spec/symbiont/generators_spec.rb +38 -28
  48. data/spec/symbiont/locators_spec.rb +68 -68
  49. data/spec/symbiont/platform_object_spec.rb +2 -4
  50. data/spec/symbiont/symbiont_spec.rb +10 -8
  51. data/spec/symbiont/web_object_spec.rb +194 -194
  52. data/spec/symbiont/web_objects/button_spec.rb +38 -30
  53. data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
  54. data/spec/symbiont/web_objects/div_spec.rb +18 -11
  55. data/spec/symbiont/web_objects/heading_spec.rb +22 -0
  56. data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
  57. data/spec/symbiont/web_objects/label_spec.rb +18 -0
  58. data/spec/symbiont/web_objects/link_spec.rb +33 -33
  59. data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
  60. data/spec/symbiont/web_objects/option_spec.rb +9 -9
  61. data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
  62. data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
  63. data/spec/symbiont/web_objects/radio_spec.rb +27 -27
  64. data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
  65. data/spec/symbiont/web_objects/span_spec.rb +18 -11
  66. data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
  67. data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
  68. data/spec/symbiont/web_objects/table_spec.rb +61 -61
  69. data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
  70. data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
  71. data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
  72. data/specs/common/support/browser.rb +25 -0
  73. data/specs/common/support/env.rb +6 -0
  74. data/specs/common/support/events.rb +15 -0
  75. data/specs/enclosers.feature +9 -0
  76. data/specs/evaluators.feature +26 -0
  77. data/specs/pages/characters.rb +22 -0
  78. data/specs/pages/home.rb +9 -0
  79. data/specs/pages/stardate.rb +23 -0
  80. data/specs/pages/web_objects.rb +77 -0
  81. data/specs/select_list.feature +53 -0
  82. data/specs/steps/enclosers_steps.rb +17 -0
  83. data/specs/steps/evaluators_steps.rb +44 -0
  84. data/specs/steps/navigation_steps.rb +14 -0
  85. data/specs/steps/select_list_steps.rb +94 -0
  86. data/specs/steps/table_cell_steps.rb +31 -0
  87. data/specs/steps/table_steps.rb +87 -0
  88. data/specs/table.feature +49 -0
  89. data/specs/table_cell.feature +27 -0
  90. data/symbiont.gemspec +4 -1
  91. metadata +72 -6
  92. data/cucumber.yml +0 -6
@@ -1,75 +1,79 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "checkbox web objects" do
8
- context "when declared in a definition" do
9
- it "should generate methods for referencing the checkbox" do
10
- watir_definition.should respond_to(:apply_tax_checkbox)
11
- watir_definition.should respond_to(:apply_tax_object)
12
- end
13
-
14
- it "should generate methods for interacting with the checkbox" do
15
- watir_definition.should respond_to(:apply_tax_exists?)
16
- watir_definition.should respond_to(:apply_tax_visible?)
17
- watir_definition.should respond_to(:apply_tax_enabled?)
18
- watir_definition.should respond_to(:apply_tax?)
19
- watir_definition.should respond_to(:apply_tax_?)
20
- watir_definition.should respond_to(:apply_tax!)
21
- watir_definition.should respond_to(:apply_tax_checked?)
22
- watir_definition.should respond_to(:check_apply_tax)
23
- watir_definition.should respond_to(:uncheck_apply_tax)
24
- end
25
- end
26
-
27
- context "when used by the watir platform" do
28
- it "should locate the checkbox" do
29
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
30
- web_object = watir_definition.apply_tax_object
31
- web_object.should_not be_nil
32
- web_object.should be_instance_of Symbiont::WebObjects::CheckBox
33
- end
34
-
35
- it "should determine if a checkbox exists" do
36
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
37
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
38
- watir_definition.apply_tax_exists?.should be_true
39
- watir_definition.apply_tax?.should be_true
40
- end
41
-
42
- it "should determine if a checkbox is visible" do
43
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
44
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
- watir_definition.apply_tax_visible?.should be_true
46
- watir_definition.apply_tax_?.should be_true
47
- end
48
-
49
- it "should determine if a checkbox is enabled" do
50
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
51
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
52
- watir_definition.apply_tax_enabled?.should be_true
53
- watir_definition.apply_tax!.should be_true
54
- end
55
-
56
- it "should determine if a checkbox is checked" do
57
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
58
- watir_browser.should_receive(:set?).and_return(true)
59
- watir_definition.apply_tax_checked?.should be_true
60
- end
61
-
62
- it "should be able to check a checkbox" do
63
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
64
- watir_browser.should_receive(:set)
65
- watir_definition.check_apply_tax
66
- end
67
-
68
- it "should be able to uncheck a checkbox" do
69
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
70
- watir_browser.should_receive(:clear)
71
- watir_definition.uncheck_apply_tax
72
- end
73
- end
74
- end
75
- end
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::Generators do
4
+ let(:watir_browser) { mock_browser_for_watir }
5
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
+
7
+ describe "checkbox generators" do
8
+ context "when declared on a page definition" do
9
+ it "should generate methods for referencing the checkbox" do
10
+ watir_definition.should respond_to(:apply_tax_checkbox)
11
+ watir_definition.should respond_to(:apply_tax_object)
12
+ end
13
+
14
+ it "should generate methods for interacting with the checkbox" do
15
+ watir_definition.should respond_to(:apply_tax_exists?)
16
+ watir_definition.should respond_to(:apply_tax_visible?)
17
+ watir_definition.should respond_to(:apply_tax_enabled?)
18
+ watir_definition.should respond_to(:apply_tax?)
19
+ watir_definition.should respond_to(:apply_tax_?)
20
+ watir_definition.should respond_to(:apply_tax!)
21
+ watir_definition.should respond_to(:apply_tax_checked?)
22
+ watir_definition.should respond_to(:check_apply_tax)
23
+ watir_definition.should respond_to(:uncheck_apply_tax)
24
+ end
25
+ end
26
+
27
+ context "when used by the watir platform" do
28
+ it "should locate the checkbox" do
29
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
30
+ web_object = watir_definition.apply_tax_object
31
+ web_object.should_not be_nil
32
+ web_object.should be_instance_of Symbiont::WebObjects::CheckBox
33
+ end
34
+
35
+ it "should determine if a checkbox exists" do
36
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
37
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
38
+ watir_definition.apply_tax_exists?.should be_true
39
+ watir_definition.apply_tax?.should be_true
40
+ end
41
+
42
+ it "should determine if a checkbox is visible" do
43
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
44
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
+ watir_definition.apply_tax_visible?.should be_true
46
+ watir_definition.apply_tax_?.should be_true
47
+ end
48
+
49
+ it "should determine if a checkbox is enabled" do
50
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
51
+ watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
52
+ watir_definition.apply_tax_enabled?.should be_true
53
+ watir_definition.apply_tax!.should be_true
54
+ end
55
+
56
+ it "should determine if a checkbox is checked" do
57
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
58
+ watir_browser.should_receive(:set?).and_return(true)
59
+ watir_definition.apply_tax_checked?.should be_true
60
+ end
61
+
62
+ it "should be able to check a checkbox" do
63
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
64
+ watir_browser.should_receive(:set)
65
+ watir_definition.check_apply_tax
66
+ end
67
+
68
+ it "should be able to uncheck a checkbox" do
69
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
70
+ watir_browser.should_receive(:clear)
71
+ watir_definition.uncheck_apply_tax
72
+ end
73
+
74
+ it "should call a block on the checkbox if specified" do
75
+ watir_definition.apply_fee_object.should == "apply_fee"
76
+ end
77
+ end
78
+ end
79
+ end
@@ -1,52 +1,56 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "div web objects" do
8
- context "when declared in a definition" do
9
- it "should generate methods for referencing the div" do
10
- watir_definition.should respond_to(:section_div)
11
- watir_definition.should respond_to(:section_object)
12
- end
13
-
14
- it "should generate methods for interacting with the div" do
15
- watir_definition.should respond_to(:section_exists?)
16
- watir_definition.should respond_to(:section_visible?)
17
- watir_definition.should respond_to(:section?)
18
- watir_definition.should respond_to(:section_?)
19
- watir_definition.should respond_to(:section)
20
- end
21
- end
22
-
23
- context "when used by the watir platform" do
24
- it "should locate the div" do
25
- watir_browser.should_receive(:div).and_return(watir_browser)
26
- web_object = watir_definition.section_div
27
- web_object.should_not be_nil
28
- web_object.should be_instance_of Symbiont::WebObjects::Div
29
- end
30
-
31
- it "should determine if a div exists" do
32
- watir_browser.should_receive(:div).twice.and_return(watir_browser)
33
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
34
- watir_definition.section_exists?.should be_true
35
- watir_definition.section?.should be_true
36
- end
37
-
38
- it "should determine if a div is visible" do
39
- watir_browser.should_receive(:div).twice.and_return(watir_browser)
40
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
- watir_definition.section_visible?.should be_true
42
- watir_definition.section_?.should be_true
43
- end
44
-
45
- it "should return the text of a div" do
46
- watir_browser.should_receive(:div).and_return(watir_browser)
47
- watir_browser.should_receive(:text).and_return("testing")
48
- watir_definition.section.should == "testing"
49
- end
50
- end
51
- end
52
- end
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::Generators do
4
+ let(:watir_browser) { mock_browser_for_watir }
5
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
+
7
+ describe "div generators" do
8
+ context "when declared on a page definition" do
9
+ it "should generate methods for referencing the div" do
10
+ watir_definition.should respond_to(:section_div)
11
+ watir_definition.should respond_to(:section_object)
12
+ end
13
+
14
+ it "should generate methods for interacting with the div" do
15
+ watir_definition.should respond_to(:section_exists?)
16
+ watir_definition.should respond_to(:section_visible?)
17
+ watir_definition.should respond_to(:section?)
18
+ watir_definition.should respond_to(:section_?)
19
+ watir_definition.should respond_to(:section)
20
+ end
21
+ end
22
+
23
+ context "when used by the watir platform" do
24
+ it "should locate the div" do
25
+ watir_browser.should_receive(:div).and_return(watir_browser)
26
+ web_object = watir_definition.section_div
27
+ web_object.should_not be_nil
28
+ web_object.should be_instance_of Symbiont::WebObjects::Div
29
+ end
30
+
31
+ it "should determine if a div exists" do
32
+ watir_browser.should_receive(:div).twice.and_return(watir_browser)
33
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
34
+ watir_definition.section_exists?.should be_true
35
+ watir_definition.section?.should be_true
36
+ end
37
+
38
+ it "should determine if a div is visible" do
39
+ watir_browser.should_receive(:div).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
+ watir_definition.section_visible?.should be_true
42
+ watir_definition.section_?.should be_true
43
+ end
44
+
45
+ it "should return the text of a div" do
46
+ watir_browser.should_receive(:div).and_return(watir_browser)
47
+ watir_browser.should_receive(:text).and_return("testing")
48
+ watir_definition.section.should == "testing"
49
+ end
50
+
51
+ it "should call a block on the div if specified" do
52
+ watir_definition.aside_object.should == "aside"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::Generators do
4
+ let(:watir_browser) { mock_browser_for_watir }
5
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
+
7
+ describe "hidden field generators" do
8
+ context "when declared on a page definition" do
9
+ it "should generate methods for referencing the hidden field" do
10
+ watir_definition.should respond_to(:ssn_hidden_field)
11
+ watir_definition.should respond_to(:ssn_object)
12
+ end
13
+
14
+ it "should generate methods for interacting with the hidden field" do
15
+ watir_definition.should respond_to(:ssn)
16
+ watir_definition.should respond_to(:ssn_exists?)
17
+ watir_definition.should respond_to(:ssn_visible?)
18
+ watir_definition.should respond_to(:ssn_enabled?)
19
+ watir_definition.should respond_to(:ssn?)
20
+ watir_definition.should respond_to(:ssn_?)
21
+ watir_definition.should respond_to(:ssn!)
22
+ end
23
+ end
24
+
25
+ context "when used by the watir platform" do
26
+ it "should locate the hidden field" do
27
+ watir_browser.should_receive(:hidden).and_return(watir_browser)
28
+ web_object = watir_definition.ssn_object
29
+ web_object.should_not be_nil
30
+ web_object.should be_instance_of Symbiont::WebObjects::HiddenField
31
+ end
32
+
33
+ it "should retrieve text from the text field" do
34
+ watir_browser.should_receive(:hidden).and_return(watir_browser)
35
+ watir_browser.should_receive(:value).and_return("testing")
36
+ watir_definition.ssn.should == "testing"
37
+ end
38
+
39
+ it "should determine if a hidden field exists" do
40
+ watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
41
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
42
+ watir_definition.ssn_exists?.should be_true
43
+ watir_definition.ssn?.should be_true
44
+ end
45
+
46
+ it "should determine if a hidden field is visible" do
47
+ watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
48
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
49
+ watir_definition.ssn_visible?.should be_true
50
+ watir_definition.ssn_?.should be_true
51
+ end
52
+
53
+ it "should determine if a hidden field is enabled" do
54
+ watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
55
+ watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
56
+ watir_definition.ssn_enabled?.should be_true
57
+ watir_definition.ssn!.should be_true
58
+ end
59
+
60
+ it "should call a block on the hidden field if specified" do
61
+ watir_definition.visa_object.should == "visa"
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,59 +1,62 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
4
+ let(:watir_browser) { mock_browser_for_watir }
5
5
  let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
6
 
7
- describe "link web objects" do
8
- context "when declared in a definition" do
7
+ describe "link generators" do
8
+ context "when declared on a page definition" do
9
9
  it "should generate methods for referencing the link" do
10
- watir_definition.should respond_to(:reset_password_object)
11
- watir_definition.should respond_to(:reset_password_link)
10
+ watir_definition.should respond_to(:welcome_object)
11
+ watir_definition.should respond_to(:welcome_link)
12
12
  end
13
13
 
14
14
  it "should generate methods for interacting with the link" do
15
- watir_definition.should respond_to(:reset_password)
16
- watir_definition.should respond_to(:reset_password_text)
17
- watir_definition.should respond_to(:reset_password_exists?)
18
- watir_definition.should respond_to(:reset_password_visible?)
19
- watir_definition.should respond_to(:reset_password?)
20
- watir_definition.should respond_to(:reset_password_?)
15
+ watir_definition.should respond_to(:welcome)
16
+ watir_definition.should respond_to(:welcome_text)
17
+ watir_definition.should respond_to(:welcome_exists?)
18
+ watir_definition.should respond_to(:welcome_visible?)
19
+ watir_definition.should respond_to(:welcome?)
20
+ watir_definition.should respond_to(:welcome_?)
21
21
  end
22
22
  end
23
23
 
24
24
  context "when used by the watir platform" do
25
+ it "should click the link" do
26
+ watir_browser.stub_chain(:link, :click)
27
+ watir_definition.welcome
28
+ end
29
+
25
30
  it "should locate the link" do
26
31
  watir_browser.should_receive(:link).and_return(watir_browser)
27
- web_object = watir_definition.reset_password_object
32
+ web_object = watir_definition.welcome_object
28
33
  web_object.should_not be_nil
29
34
  web_object.should be_instance_of Symbiont::WebObjects::Link
30
35
  end
31
36
 
32
- it "should return the text of the link" do
37
+ it "should retrieve text from the link" do
33
38
  watir_browser.should_receive(:link).and_return(watir_browser)
34
- watir_browser.should_receive(:text).and_return('Reset Password')
35
- watir_definition.reset_password_text.should == "Reset Password"
36
- end
37
-
38
- it "should click the link" do
39
- watir_browser.stub_chain(:link, :click)
40
- watir_definition.reset_password
39
+ watir_browser.should_receive(:text).and_return('Welcome')
40
+ watir_definition.welcome_text.should == "Welcome"
41
41
  end
42
42
 
43
43
  it "should determine if a link exists" do
44
44
  watir_browser.should_receive(:link).twice.and_return(watir_browser)
45
45
  watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
46
- watir_definition.reset_password_exists?.should be_true
47
- watir_definition.reset_password?.should be_true
46
+ watir_definition.welcome_exists?.should be_true
47
+ watir_definition.welcome?.should be_true
48
48
  end
49
-
49
+
50
50
  it "should determine if a link is visible" do
51
51
  watir_browser.should_receive(:link).twice.and_return(watir_browser)
52
52
  watir_browser.should_receive(:present?).twice.and_return(watir_browser)
53
- watir_definition.reset_password_visible?.should be_true
54
- watir_definition.reset_password_?.should be_true
53
+ watir_definition.welcome_visible?.should be_true
54
+ watir_definition.welcome_?.should be_true
55
55
  end
56
- end
57
56
 
57
+ it "should call a block on the link if specified" do
58
+ watir_definition.greetings_object.should == "greetings"
59
+ end
60
+ end
58
61
  end
59
- end
62
+ end
@@ -1,29 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
4
+ let(:watir_browser) { mock_browser_for_watir }
5
5
  let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
6
 
7
- describe "paragraph web objects" do
8
- context "when declared in a definition" do
7
+ describe "paragraph generators" do
8
+ context "when declared on a page definition" do
9
9
  it "should generate methods for referencing the paragraph" do
10
- watir_definition.should respond_to(:intro_paragraph)
11
- watir_definition.should respond_to(:intro_object)
10
+ watir_definition.should respond_to(:first_paragraph)
11
+ watir_definition.should respond_to(:first_object)
12
+ watir_definition.should respond_to(:last_paragraph)
12
13
  end
13
14
 
14
15
  it "should generate methods for interacting with the paragraph" do
15
- watir_definition.should respond_to(:intro_exists?)
16
- watir_definition.should respond_to(:intro_visible?)
17
- watir_definition.should respond_to(:intro?)
18
- watir_definition.should respond_to(:intro_?)
19
- watir_definition.should respond_to(:intro)
16
+ watir_definition.should respond_to(:first_exists?)
17
+ watir_definition.should respond_to(:first_visible?)
18
+ watir_definition.should respond_to(:first?)
19
+ watir_definition.should respond_to(:first_?)
20
+ watir_definition.should respond_to(:first)
20
21
  end
21
22
  end
22
23
 
23
24
  context "when used by the watir platform" do
24
25
  it "should locate the paragraph" do
25
26
  watir_browser.should_receive(:p).and_return(watir_browser)
26
- web_object = watir_definition.intro_paragraph
27
+ web_object = watir_definition.first_paragraph
27
28
  web_object.should_not be_nil
28
29
  web_object.should be_instance_of Symbiont::WebObjects::Paragraph
29
30
  end
@@ -31,22 +32,26 @@ describe Symbiont::Generators do
31
32
  it "should determine if a paragraph exists" do
32
33
  watir_browser.should_receive(:p).twice.and_return(watir_browser)
33
34
  watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
34
- watir_definition.intro_exists?.should be_true
35
- watir_definition.intro?.should be_true
35
+ watir_definition.first_exists?.should be_true
36
+ watir_definition.first?.should be_true
36
37
  end
37
38
 
38
39
  it "should determine if a paragraph is visible" do
39
40
  watir_browser.should_receive(:p).twice.and_return(watir_browser)
40
41
  watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
- watir_definition.intro_visible?.should be_true
42
- watir_definition.intro_?.should be_true
42
+ watir_definition.first_visible?.should be_true
43
+ watir_definition.first_?.should be_true
43
44
  end
44
45
 
45
46
  it "should return the text of a paragraph" do
46
47
  watir_browser.should_receive(:p).and_return(watir_browser)
47
48
  watir_browser.should_receive(:text).and_return("testing")
48
- watir_definition.intro.should == "testing"
49
+ watir_definition.first.should == "testing"
50
+ end
51
+
52
+ it "should call a block on the paragraph if specified" do
53
+ watir_definition.middle_object.should == "middle"
49
54
  end
50
55
  end
51
56
  end
52
- end
57
+ end
@@ -1,77 +1,76 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "radio web objects" do
8
- context "when declared in a definition" do
9
- it "should generate methods for referencing the radio" do
10
- watir_definition.should respond_to(:include_tax_radio)
11
- watir_definition.should respond_to(:include_tax_object)
12
- end
13
-
14
- it "should generate methods for interacting with the radio" do
15
- watir_definition.should respond_to(:include_tax_exists?)
16
- watir_definition.should respond_to(:include_tax_visible?)
17
- watir_definition.should respond_to(:include_tax_enabled?)
18
- watir_definition.should respond_to(:include_tax?)
19
- watir_definition.should respond_to(:include_tax_?)
20
- watir_definition.should respond_to(:include_tax!)
21
- watir_definition.should respond_to(:include_tax_selected?)
22
- watir_definition.should respond_to(:include_tax_set?)
23
- watir_definition.should respond_to(:set_include_tax)
24
- end
25
- end
26
-
27
- context "when used by the watir platform" do
28
- it "should locate the radio" do
29
- watir_browser.should_receive(:radio).and_return(watir_browser)
30
- web_object = watir_definition.include_tax_radio
31
- web_object.should_not be_nil
32
- web_object.should be_instance_of Symbiont::WebObjects::Radio
33
- end
34
-
35
- it "should determine if a radio exists" do
36
- watir_browser.should_receive(:radio).twice.and_return(watir_browser)
37
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
38
- watir_definition.include_tax_exists?.should be_true
39
- watir_definition.include_tax?.should be_true
40
- end
41
-
42
- it "should determine if a radio is visible" do
43
- watir_browser.should_receive(:radio).twice.and_return(watir_browser)
44
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
- watir_definition.include_tax_visible?.should be_true
46
- watir_definition.include_tax_?.should be_true
47
- end
48
-
49
- it "should determine if a radio is enabled" do
50
- watir_browser.should_receive(:radio).twice.and_return(watir_browser)
51
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
52
- watir_definition.include_tax_enabled?.should be_true
53
- watir_definition.include_tax!.should be_true
54
- end
55
-
56
- it "should determine if a radio is set" do
57
- watir_browser.should_receive(:radio).twice.and_return(watir_browser)
58
- watir_browser.should_receive(:set?).twice.and_return(watir_browser)
59
- watir_definition.include_tax_selected?.should be_true
60
- watir_definition.include_tax_set?.should be_true
61
- end
62
-
63
- it "should set a radio" do
64
- watir_browser.should_receive(:radio).twice.and_return(watir_browser)
65
- watir_browser.should_receive(:set).twice.and_return(watir_browser)
66
- watir_definition.select_include_tax
67
- watir_definition.set_include_tax
68
- end
69
-
70
- #it "should clear a radio" do
71
- # watir_browser.should_receive(:radio).and_return(watir_browser)
72
- # watir_browser.should_receive(:clear).and_return(watir_browser)
73
- # watir_definition.clear_include_tax
74
- #end
75
- end
76
- end
77
- end
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::Generators do
4
+ let(:watir_browser) { mock_browser_for_watir }
5
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
+
7
+ describe "radio web objects" do
8
+ context "when declared on a page definition" do
9
+ it "should generate methods for referencing the radio" do
10
+ watir_definition.should respond_to(:include_tax_radio)
11
+ watir_definition.should respond_to(:include_tax_object)
12
+ end
13
+
14
+ it "should generate methods for interacting with the radio" do
15
+ watir_definition.should respond_to(:include_tax_exists?)
16
+ watir_definition.should respond_to(:include_tax_visible?)
17
+ watir_definition.should respond_to(:include_tax_enabled?)
18
+ watir_definition.should respond_to(:include_tax?)
19
+ watir_definition.should respond_to(:include_tax_?)
20
+ watir_definition.should respond_to(:include_tax!)
21
+ watir_definition.should respond_to(:include_tax_selected?)
22
+ watir_definition.should respond_to(:include_tax_set?)
23
+ watir_definition.should respond_to(:set_include_tax)
24
+ end
25
+ end
26
+
27
+ context "when used by the watir platform" do
28
+ it "should locate the radio" do
29
+ watir_browser.should_receive(:radio).and_return(watir_browser)
30
+ web_object = watir_definition.include_tax_radio
31
+ web_object.should_not be_nil
32
+ web_object.should be_instance_of Symbiont::WebObjects::Radio
33
+ end
34
+
35
+ it "should determine if a radio exists" do
36
+ watir_browser.should_receive(:radio).twice.and_return(watir_browser)
37
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
38
+ watir_definition.include_tax_exists?.should be_true
39
+ watir_definition.include_tax?.should be_true
40
+ end
41
+
42
+ it "should determine if a radio is visible" do
43
+ watir_browser.should_receive(:radio).twice.and_return(watir_browser)
44
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
+ watir_definition.include_tax_visible?.should be_true
46
+ watir_definition.include_tax_?.should be_true
47
+ end
48
+
49
+ it "should determine if a radio is enabled" do
50
+ watir_browser.should_receive(:radio).twice.and_return(watir_browser)
51
+ watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
52
+ watir_definition.include_tax_enabled?.should be_true
53
+ watir_definition.include_tax!.should be_true
54
+ end
55
+
56
+ it "should determine if a radio is set" do
57
+ watir_browser.should_receive(:radio).twice.and_return(watir_browser)
58
+ watir_browser.should_receive(:set?).twice.and_return(watir_browser)
59
+ watir_definition.include_tax_selected?.should be_true
60
+ watir_definition.include_tax_set?.should be_true
61
+ end
62
+
63
+ it "should set a radio" do
64
+ watir_browser.should_receive(:radio).twice.and_return(watir_browser)
65
+ watir_browser.should_receive(:set).twice.and_return(watir_browser)
66
+ watir_definition.select_include_tax
67
+ watir_definition.set_include_tax
68
+ end
69
+
70
+ it "should call a block on the radio if specified" do
71
+ watir_definition.include_fee_object.should == "include_fee"
72
+ end
73
+ end
74
+
75
+ end
76
+ end