terminus_spec 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +7 -0
- data/HISTORY.md +54 -0
- data/LICENSE +20 -0
- data/README.md +13 -0
- data/Rakefile +43 -0
- data/cucumber.yml +6 -0
- data/lib/terminus_spec.rb +200 -0
- data/lib/terminus_spec/factory.rb +27 -0
- data/lib/terminus_spec/generators.rb +80 -0
- data/lib/terminus_spec/locators.rb +23 -0
- data/lib/terminus_spec/logger.rb +7 -0
- data/lib/terminus_spec/matchers.rb +41 -0
- data/lib/terminus_spec/platform_selenium.rb +18 -0
- data/lib/terminus_spec/platform_selenium/platform_object.rb +214 -0
- data/lib/terminus_spec/platform_selenium/web_objects/all.rb +98 -0
- data/lib/terminus_spec/platform_selenium/web_objects/button.rb +13 -0
- data/lib/terminus_spec/platform_selenium/web_objects/link.rb +13 -0
- data/lib/terminus_spec/platform_selenium/web_objects/text_field.rb +14 -0
- data/lib/terminus_spec/platform_watir.rb +18 -0
- data/lib/terminus_spec/platform_watir/platform_object.rb +190 -0
- data/lib/terminus_spec/platform_watir/web_objects/all.rb +88 -0
- data/lib/terminus_spec/platform_watir/web_objects/text_field.rb +13 -0
- data/lib/terminus_spec/platforms.rb +25 -0
- data/lib/terminus_spec/version.rb +3 -0
- data/lib/terminus_spec/web_objects/all.rb +172 -0
- data/lib/terminus_spec/web_objects/button.rb +32 -0
- data/lib/terminus_spec/web_objects/link.rb +40 -0
- data/lib/terminus_spec/web_objects/text_field.rb +45 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/terminus_spec/factory_spec.rb +40 -0
- data/spec/terminus_spec/generators_spec.rb +179 -0
- data/spec/terminus_spec/locators_spec.rb +30 -0
- data/spec/terminus_spec/platform_selenium_spec.rb +28 -0
- data/spec/terminus_spec/platform_watir_spec.rb +32 -0
- data/spec/terminus_spec/platforms_spec.rb +43 -0
- data/spec/terminus_spec/terminus_spec.rb +271 -0
- data/spec/terminus_spec/web_objects/all_spec.rb +87 -0
- data/spec/terminus_spec/web_objects/button_spec.rb +35 -0
- data/spec/terminus_spec/web_objects/link_spec.rb +46 -0
- data/spec/terminus_spec/web_objects/text_field_spec.rb +48 -0
- data/spec/terminus_spec/webobject_selenium_spec.rb +154 -0
- data/spec/terminus_spec/webobject_watir_spec.rb +120 -0
- data/specs/app/favicon.ico +0 -0
- data/specs/app/images/mass_extinction.jpg +0 -0
- data/specs/app/index.html +20 -0
- data/specs/app/modal_1.html +41 -0
- data/specs/app/modal_2.html +29 -0
- data/specs/app/server.rb +25 -0
- data/specs/app/style.css +18 -0
- data/specs/app/success_1.html +12 -0
- data/specs/app/success_2.html +12 -0
- data/specs/app/test_event.html +39 -0
- data/specs/app/test_form.html +114 -0
- data/specs/app/test_frame.html +15 -0
- data/specs/app/test_iframe.html +15 -0
- data/specs/app/test_static.html +92 -0
- data/specs/engine/borg.rb +27 -0
- data/specs/engine/hooks.rb +23 -0
- data/terminus_spec.gemspec +31 -0
- metadata +198 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
module TerminusSpec
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class Button < WebObject
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
mixin_web_objects_for platform
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def self.locators_for_watir
|
14
|
+
super + [:text, :value]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.locators_for_selenium
|
18
|
+
super + [:value]
|
19
|
+
end
|
20
|
+
|
21
|
+
def mixin_web_objects_for(platform)
|
22
|
+
super
|
23
|
+
if platform[:platform] == :selenium_webdriver
|
24
|
+
require "terminus_spec/platform_selenium/web_objects/button"
|
25
|
+
self.class.send :include, TerminusSpec::Platforms::SeleniumWebDriver::Button
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end # class Button
|
30
|
+
|
31
|
+
end # module WebObjects
|
32
|
+
end # module TerminusSpec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module TerminusSpec
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class Link < WebObject
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
mixin_web_objects_for platform
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def self.locators_for_watir
|
14
|
+
super + [:href, :text]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.mappings_for_watir
|
18
|
+
super.merge({:link => :text, :link_text => :text})
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.locators_for_selenium
|
22
|
+
super + [:link, :link_text]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.mappings_for_selenium
|
26
|
+
super.merge(:text => :link_text)
|
27
|
+
end
|
28
|
+
|
29
|
+
def mixin_web_objects_for(platform)
|
30
|
+
super
|
31
|
+
if platform[:platform] == :selenium_webdriver
|
32
|
+
require "terminus_spec/platform_selenium/web_objects/link"
|
33
|
+
self.class.send :include, TerminusSpec::Platforms::SeleniumWebDriver::Link
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end # class Link
|
38
|
+
|
39
|
+
end # module WebObjects
|
40
|
+
end # module TerminusSpec
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module TerminusSpec
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class TextField < WebObject
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
mixin_web_objects_for platform
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def self.locators_for_watir
|
14
|
+
super + [:tag_name]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.mappings_for_watir
|
18
|
+
super.merge({:css => :tag_name})
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.locators_for_selenium
|
22
|
+
super + [:css]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.mappings_for_selenium
|
26
|
+
super.merge({:tag_name => :css})
|
27
|
+
end
|
28
|
+
|
29
|
+
def mixin_web_objects_for(platform)
|
30
|
+
super
|
31
|
+
if platform[:platform] == :watir_webdriver
|
32
|
+
require "terminus_spec/platform_watir/web_objects/text_field"
|
33
|
+
self.class.send :include, TerminusSpec::Platforms::WatirWebDriver::TextField
|
34
|
+
elsif platform[:platform] == :selenium_webdriver
|
35
|
+
require "terminus_spec/platform_selenium/web_objects/text_field"
|
36
|
+
self.class.send :include, TerminusSpec::Platforms::SeleniumWebDriver::TextField
|
37
|
+
else
|
38
|
+
raise ArgumentError, "Unable to mixin web objects for the specified platform."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end # class TextField
|
43
|
+
|
44
|
+
end # module WebObjects
|
45
|
+
end # module TerminusSpec
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'watir-webdriver'
|
5
|
+
require 'selenium-webdriver'
|
6
|
+
require 'terminus_spec'
|
7
|
+
|
8
|
+
require 'simplecov'
|
9
|
+
SimpleCov.start { add_filter "/spec/" }
|
10
|
+
|
11
|
+
def mock_browser_with_watir
|
12
|
+
watir_browser = double('watir')
|
13
|
+
watir_browser.stub(:is_a?).with(anything()).and_return(false)
|
14
|
+
watir_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(false)
|
15
|
+
watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
|
16
|
+
watir_browser
|
17
|
+
end
|
18
|
+
|
19
|
+
def mock_browser_with_selenium
|
20
|
+
selenium_browser = double('selenium')
|
21
|
+
selenium_browser.stub(:is_a?).with(anything()).and_return(false)
|
22
|
+
selenium_browser.stub(:is_a?).with(Watir::Browser).and_return(false)
|
23
|
+
selenium_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
|
24
|
+
selenium_browser
|
25
|
+
end
|
26
|
+
|
27
|
+
def mock_driver(browser, platform_object)
|
28
|
+
driver = double('driver')
|
29
|
+
driver.stub(:works_for?).with(anything()).and_return(false)
|
30
|
+
driver.stub(:works_for?).with(browser).and_return(true)
|
31
|
+
driver.stub(:create_platform_object_for).and_return platform_object
|
32
|
+
driver
|
33
|
+
end
|
34
|
+
|
35
|
+
def mock_drivers_list(drivers)
|
36
|
+
TerminusSpec::Platforms.stub(:list).and_return drivers
|
37
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'terminus_spec/factory'
|
3
|
+
|
4
|
+
class FactoryTestPage
|
5
|
+
include TerminusSpec
|
6
|
+
|
7
|
+
url_is "http://testerstories.com"
|
8
|
+
end
|
9
|
+
|
10
|
+
class TestFactory
|
11
|
+
include TerminusSpec::Factory
|
12
|
+
attr_accessor :browser
|
13
|
+
end
|
14
|
+
|
15
|
+
describe TerminusSpec::Factory do
|
16
|
+
before(:each) do
|
17
|
+
@factory = TestFactory.new
|
18
|
+
@factory.browser = mock_browser_with_watir
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to visit a new page after it has been created" do
|
22
|
+
@factory.browser.should_receive(:goto)
|
23
|
+
@factory.visit FactoryTestPage do |page|
|
24
|
+
page.should be_instance_of FactoryTestPage
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should set an instance variable that can be used outside of the page block" do
|
29
|
+
page = @factory.on FactoryTestPage
|
30
|
+
current_page = @factory.instance_variable_get "@page"
|
31
|
+
current_page.should === page
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create a new page object and execute a block if one is provided" do
|
35
|
+
@factory.browser.should_not_receive(:goto)
|
36
|
+
@factory.on FactoryTestPage do |page|
|
37
|
+
page.should be_instance_of FactoryTestPage
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestPage
|
4
|
+
include TerminusSpec
|
5
|
+
|
6
|
+
url_is "http://testerstories.com"
|
7
|
+
|
8
|
+
link :static_text_examples, :text => "Static Text Examples"
|
9
|
+
link :static_text_examples_b do |this| "testing" end
|
10
|
+
text_field :server, :id => "server"
|
11
|
+
text_field :server_b do |this| "testing" end
|
12
|
+
button :submit, :id => "submit"
|
13
|
+
button :submit_b do |content| "testing" end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe TerminusSpec::Generators do
|
17
|
+
let(:watir_browser) { mock_browser_with_watir }
|
18
|
+
let(:watir_page) { TestPage.new(watir_browser) }
|
19
|
+
|
20
|
+
let(:selenium_browser) { mock_browser_with_selenium }
|
21
|
+
let(:selenium_page) { TestPage.new(selenium_browser) }
|
22
|
+
|
23
|
+
describe "there are page objects that contain location information" do
|
24
|
+
context "which means" do
|
25
|
+
it "it should be possible to navigate to a page when requested" do
|
26
|
+
watir_browser.should_receive(:goto)
|
27
|
+
page = TestPage.new(watir_browser, true)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "it should not navigate to a page when not requested" do
|
31
|
+
watir_browser.should_not_receive(:goto)
|
32
|
+
page = TestPage.new(watir_browser)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "it should not navigate to a page when a url is not specified" do
|
36
|
+
watir_browser.should_not_receive(:goto)
|
37
|
+
page = TestPage.new(watir_browser)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "there are link generators" do
|
43
|
+
context "and when a link is declared on a page" do
|
44
|
+
it "methods for querying and manipulating the link should be generated" do
|
45
|
+
watir_page.should respond_to(:static_text_examples)
|
46
|
+
watir_page.should respond_to(:static_text_examples_object)
|
47
|
+
watir_page.should respond_to(:static_text_examples_link)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "blocks declared with the object will be executed" do
|
51
|
+
watir_page.static_text_examples_b_link.should == "testing"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "and when used on the watir platform implementation" do
|
56
|
+
it "it should be possible to find a link object" do
|
57
|
+
watir_browser.should_receive(:link).and_return(watir_browser)
|
58
|
+
web_object = watir_page.static_text_examples_object
|
59
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Link
|
60
|
+
end
|
61
|
+
|
62
|
+
it "it should be possible to select (and thus click) a link" do
|
63
|
+
watir_browser.stub_chain(:link, :click)
|
64
|
+
watir_page.static_text_examples
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "and when used on the selenium platform implementation" do
|
69
|
+
it "it should be possible to find a link object" do
|
70
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
71
|
+
web_object = selenium_page.static_text_examples_object
|
72
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Link
|
73
|
+
end
|
74
|
+
|
75
|
+
it "it should be possible to select (and thus click) a link" do
|
76
|
+
selenium_browser.stub_chain(:find_element, :click)
|
77
|
+
selenium_page.static_text_examples
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "there are text field generators" do
|
83
|
+
context "and when a text field is declared on a page" do
|
84
|
+
it "methods for querying and manipulating the text field should be generated" do
|
85
|
+
watir_page.should respond_to(:server)
|
86
|
+
watir_page.should respond_to(:server=)
|
87
|
+
watir_page.should respond_to(:server_object)
|
88
|
+
watir_page.should respond_to(:server_text_field)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "blocks declared with the object will be executed" do
|
92
|
+
watir_page.server_b_object.should == "testing"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "and when used on the watir platform implementation" do
|
97
|
+
it "it should be possible to find a text field object" do
|
98
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
99
|
+
web_object = watir_page.server_object
|
100
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::TextField
|
101
|
+
end
|
102
|
+
|
103
|
+
it "it should be possible to get the text from a text field" do
|
104
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
105
|
+
watir_browser.should_receive(:value).and_return("Testing")
|
106
|
+
watir_page.server.should == "Testing"
|
107
|
+
end
|
108
|
+
|
109
|
+
it "it should be possible to type text into a text field" do
|
110
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
111
|
+
watir_browser.should_receive(:set).with("Testing")
|
112
|
+
watir_page.server = "Testing"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "and when used on the selenium platform implementation" do
|
117
|
+
it "it should be possible to find a text field object" do
|
118
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
119
|
+
web_object = selenium_page.server_object
|
120
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::TextField
|
121
|
+
end
|
122
|
+
|
123
|
+
it "it should be possible to get the text from a text field" do
|
124
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
125
|
+
selenium_browser.should_receive(:attribute).with('value').and_return("Testing")
|
126
|
+
selenium_page.server.should == "Testing"
|
127
|
+
end
|
128
|
+
|
129
|
+
it "it should be possible to type text into a text field" do
|
130
|
+
selenium_browser.should_receive(:find_element).twice.and_return(selenium_browser)
|
131
|
+
selenium_browser.should_receive(:clear)
|
132
|
+
selenium_browser.should_receive(:send_keys).with("Testing")
|
133
|
+
selenium_page.server = "Testing"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "there are button generators" do
|
139
|
+
context "and when a button is declared on a page" do
|
140
|
+
it "methods for querying and manipulating the button should be generated" do
|
141
|
+
watir_page.should respond_to(:submit)
|
142
|
+
watir_page.should respond_to(:submit_object)
|
143
|
+
watir_page.should respond_to(:submit_button)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "blocks declared with the object will be executed" do
|
147
|
+
watir_page.submit_b_object.should == "testing"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "and when used on the watir platform implementation" do
|
152
|
+
it "it should be possible to find a button object" do
|
153
|
+
watir_browser.should_receive(:button).and_return(watir_browser)
|
154
|
+
web_object = watir_page.submit_object
|
155
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Button
|
156
|
+
end
|
157
|
+
|
158
|
+
it "it should be possible to click a button object" do
|
159
|
+
watir_browser.should_receive(:button).and_return(watir_browser)
|
160
|
+
watir_browser.should_receive(:click)
|
161
|
+
watir_page.submit
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context "and when used on the selenium platform implementation" do
|
166
|
+
it "it should be possible to find a button object" do
|
167
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
168
|
+
web_object = selenium_page.submit_object
|
169
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Button
|
170
|
+
end
|
171
|
+
|
172
|
+
it "it should be possible to click a button object" do
|
173
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
174
|
+
selenium_browser.should_receive(:click)
|
175
|
+
selenium_page.submit
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class LocatorTestPage
|
4
|
+
include TerminusSpec
|
5
|
+
end
|
6
|
+
|
7
|
+
describe TerminusSpec::Locators do
|
8
|
+
let(:watir_browser) { mock_browser_with_watir }
|
9
|
+
let(:watir_page) { LocatorTestPage.new(watir_browser) }
|
10
|
+
|
11
|
+
context "a web object may not have been declared but is being referenced" do
|
12
|
+
it "and so it should be able to find a link object" do
|
13
|
+
watir_browser.should_receive(:link).with(:id => 'test').and_return(watir_browser)
|
14
|
+
web_object = watir_page.link_web_object(:id => 'test')
|
15
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Link
|
16
|
+
end
|
17
|
+
|
18
|
+
it "and so it should be able to find a text field object" do
|
19
|
+
watir_browser.should_receive(:text_field).with(:id => 'test').and_return(watir_browser)
|
20
|
+
web_object = watir_page.text_field_web_object(:id => 'test')
|
21
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::TextField
|
22
|
+
end
|
23
|
+
|
24
|
+
it "and so it should be able to find a button object" do
|
25
|
+
watir_browser.should_receive(:button).with(:id => 'test').and_return(watir_browser)
|
26
|
+
web_object = watir_page.button_web_object(:id => 'test')
|
27
|
+
web_object.should be_instance_of TerminusSpec::WebObjects::Button
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TerminusSpec::Platforms::SeleniumWebDriver do
|
4
|
+
it "should be in the platform objects driver list" do
|
5
|
+
TerminusSpec::Platforms.list[:selenium_webdriver].should be TerminusSpec::Platforms::SeleniumWebDriver
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "and when used to create a platform object" do
|
9
|
+
let(:browser) { double('browser') }
|
10
|
+
let(:platform) { TerminusSpec::Platforms::SeleniumWebDriver.create_platform_object_for(browser) }
|
11
|
+
|
12
|
+
it "a SeleniumPlatformObject should be created" do
|
13
|
+
platform.should be_kind_of TerminusSpec::Platforms::SeleniumWebDriver::PlatformObject
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "and when checking if the platform can be associated with a browser" do
|
18
|
+
it "if the browser is of type Selenium::WebDriver, the platform will be associated " do
|
19
|
+
browser = mock_browser_with_selenium()
|
20
|
+
TerminusSpec::Platforms::SeleniumWebDriver.works_for?(browser).should be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "if the browser is not of type Selenium::WebDriver, the platform will not be associated" do
|
24
|
+
browser = "fake browser"
|
25
|
+
TerminusSpec::Platforms::SeleniumWebDriver.works_for?(browser).should be false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TerminusSpec::Platforms::WatirWebDriver do
|
4
|
+
it "should be in the platform objects driver list" do
|
5
|
+
TerminusSpec::Platforms.list[:watir_webdriver].should be TerminusSpec::Platforms::WatirWebDriver
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "and when used to create a platform object" do
|
9
|
+
let(:browser) { double('browser') }
|
10
|
+
let(:platform) { TerminusSpec::Platforms::WatirWebDriver.create_platform_object_for(browser) }
|
11
|
+
|
12
|
+
it "a WatirPlatformObject should be created" do
|
13
|
+
platform.should be_kind_of TerminusSpec::Platforms::WatirWebDriver::PlatformObject
|
14
|
+
end
|
15
|
+
|
16
|
+
it "the browser should be associated with the platform object" do
|
17
|
+
platform.browser.should be browser
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "and when checking if the platform can be associated with a browser" do
|
22
|
+
it "if the browser is of type Watir::Browser, the platform will be associated " do
|
23
|
+
browser = mock_browser_with_watir()
|
24
|
+
TerminusSpec::Platforms::WatirWebDriver.works_for?(browser).should be true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "if the browser is not of type Watir::Browser, the platform will not be associated" do
|
28
|
+
browser = "fake browser"
|
29
|
+
TerminusSpec::Platforms::WatirWebDriver.works_for?(browser).should be false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|