page-object-pal 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ require "open-uri"
16
16
  # end
17
17
  # end
18
18
  #
19
- # Can wrapped in a page object class method for validation.
19
+ # Can be wrapped in a page object class method for validation.
20
20
  # @example Class method
21
21
  # class Page
22
22
  # include PageObject
@@ -42,15 +42,23 @@ module PageObjectPal
42
42
  # @return [Boolean] True if no error is raised
43
43
  #
44
44
  def examine(klass, path, url)
45
+ polish! url unless url.start_with? "http://"
45
46
  diff_page(Nokogiri::HTML(open(url)), parse_class(klass, path))
46
- success!
47
+ declare_success
47
48
  end
48
49
 
49
50
  private
50
- def success!
51
+ def declare_success
51
52
  true
52
53
  end
53
54
 
55
+ #
56
+ # Ensure the given URL will work with open-uri.
57
+ #
58
+ def polish!(url)
59
+ url.replace "http://#{url}"
60
+ end
61
+
54
62
  #
55
63
  # Parse elements from the page object class methods.
56
64
  #
@@ -1,3 +1,3 @@
1
1
  module PageObjectPal
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -9,7 +9,11 @@ class Page
9
9
  link(:by_xpath, :xpath => "(//a)[1]")
10
10
  element(:by_element, :a, :xpath => "(//a)[1]")
11
11
 
12
- def self.healthy?
12
+ def self.polished_pass?
13
+ PageObjectPal.examine(self, __FILE__, "www.manta.com")
14
+ end
15
+
16
+ def self.unpolished_pass?
13
17
  PageObjectPal.examine(self, __FILE__, "http://www.manta.com")
14
18
  end
15
19
 
@@ -4,13 +4,16 @@ describe PageObjectPal do
4
4
  Given(:page) { require_relative 'Page'; Page }
5
5
  Given(:path) { File.join(File.dirname(__FILE__), "Page.rb") }
6
6
  Given(:src) { "http://www.manta.com" }
7
+ Given(:pol_src) { "www.manta.com" }
7
8
 
8
9
  context "Evaluate from outside PageObject" do
9
10
  Then { PageObjectPal.examine(page, path, src).should be_true }
11
+ Then { PageObjectPal.examine(page, path, pol_src).should be_true }
10
12
  end
11
13
 
12
14
  context "Evaluate from PageObject method" do
13
- Then { page.healthy?.should be_true }
15
+ Then { page.polished_pass?.should be_true }
16
+ Then { page.unpolished_pass?.should be_true }
14
17
  end
15
18
 
16
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object-pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-28 00:00:00.000000000 Z
12
+ date: 2013-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -130,7 +130,7 @@ files:
130
130
  - spec/dsl_conversion_spec.rb
131
131
  - spec/elements_spec.rb
132
132
  - spec/exceptions_spec.rb
133
- - spec/identifiers_spec.rb
133
+ - spec/page-object-pal_spec.rb
134
134
  - spec/spec_helper.rb
135
135
  homepage: http://github.com/jdenen/page-object-pal
136
136
  licenses:
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: -2792159632047190795
150
+ hash: 1409472162044955369
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: -2792159632047190795
159
+ hash: 1409472162044955369
160
160
  requirements: []
161
161
  rubyforge_project:
162
162
  rubygems_version: 1.8.25
@@ -170,5 +170,5 @@ test_files:
170
170
  - spec/dsl_conversion_spec.rb
171
171
  - spec/elements_spec.rb
172
172
  - spec/exceptions_spec.rb
173
- - spec/identifiers_spec.rb
173
+ - spec/page-object-pal_spec.rb
174
174
  - spec/spec_helper.rb