capybara-page-object 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +4 -4
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/capybara-page-object.gemspec +17 -17
- data/lib/capybara-page-object/page.rb +8 -6
- data/spec/page_spec.rb +13 -11
- metadata +64 -24
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source :rubygems
|
|
3
3
|
group :development do
|
4
4
|
gem "bundler", "~> 1.1.0"
|
5
5
|
gem "jeweler", "~> 1.8.3"
|
6
|
-
gem 'simplecov', :require => false
|
6
|
+
gem 'simplecov', "~> 0.6.2", :require => false
|
7
7
|
gem "rspec"
|
8
8
|
gem 'rake', '~> 0.9.2.2'
|
9
9
|
gem "rdoc", '~> 3.12'
|
@@ -12,5 +12,5 @@ end
|
|
12
12
|
group :test do
|
13
13
|
end
|
14
14
|
|
15
|
-
gem "activesupport",
|
15
|
+
gem "activesupport", "> 2.1.0" # for OrderedHash
|
16
16
|
gem "capybara"
|
data/Gemfile.lock
CHANGED
@@ -47,8 +47,8 @@ GEM
|
|
47
47
|
libwebsocket (~> 0.1.3)
|
48
48
|
multi_json (~> 1.0)
|
49
49
|
rubyzip
|
50
|
-
simplecov (0.6.
|
51
|
-
multi_json (~> 1.
|
50
|
+
simplecov (0.6.2)
|
51
|
+
multi_json (~> 1.3)
|
52
52
|
simplecov-html (~> 0.5.3)
|
53
53
|
simplecov-html (0.5.3)
|
54
54
|
xpath (0.1.4)
|
@@ -58,11 +58,11 @@ PLATFORMS
|
|
58
58
|
ruby
|
59
59
|
|
60
60
|
DEPENDENCIES
|
61
|
-
activesupport (
|
61
|
+
activesupport (> 2.1.0)
|
62
62
|
bundler (~> 1.1.0)
|
63
63
|
capybara
|
64
64
|
jeweler (~> 1.8.3)
|
65
65
|
rake (~> 0.9.2.2)
|
66
66
|
rdoc (~> 3.12)
|
67
67
|
rspec
|
68
|
-
simplecov
|
68
|
+
simplecov (~> 0.6.2)
|
data/README.markdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.6.
|
7
|
+
s.name = "capybara-page-object"
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
11
|
+
s.authors = ["Andy Waite"]
|
12
|
+
s.date = "2012-11-17"
|
13
|
+
s.description = "Page Objects for Capybara"
|
14
|
+
s.email = "andy@andywaite.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.markdown"
|
@@ -73,40 +73,40 @@ Gem::Specification.new do |s|
|
|
73
73
|
"spec/node_spec.rb",
|
74
74
|
"spec/page_spec.rb"
|
75
75
|
]
|
76
|
-
s.homepage =
|
77
|
-
s.licenses = [
|
78
|
-
s.require_paths = [
|
79
|
-
s.rubygems_version =
|
80
|
-
s.summary =
|
76
|
+
s.homepage = "http://github.com/andyw8/capybara-page-object"
|
77
|
+
s.licenses = ["MIT"]
|
78
|
+
s.require_paths = ["lib"]
|
79
|
+
s.rubygems_version = "1.8.24"
|
80
|
+
s.summary = "Page Objects for Capybara"
|
81
81
|
|
82
82
|
if s.respond_to? :specification_version then
|
83
83
|
s.specification_version = 3
|
84
84
|
|
85
85
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
86
|
-
s.add_runtime_dependency(%q<activesupport>, ["
|
86
|
+
s.add_runtime_dependency(%q<activesupport>, ["> 2.1.0"])
|
87
87
|
s.add_runtime_dependency(%q<capybara>, [">= 0"])
|
88
88
|
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
89
89
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
90
|
-
s.add_development_dependency(%q<simplecov>, ["
|
90
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0.6.2"])
|
91
91
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
92
92
|
s.add_development_dependency(%q<rake>, ["~> 0.9.2.2"])
|
93
93
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
94
94
|
else
|
95
|
-
s.add_dependency(%q<activesupport>, ["
|
95
|
+
s.add_dependency(%q<activesupport>, ["> 2.1.0"])
|
96
96
|
s.add_dependency(%q<capybara>, [">= 0"])
|
97
97
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
98
98
|
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
99
|
-
s.add_dependency(%q<simplecov>, ["
|
99
|
+
s.add_dependency(%q<simplecov>, ["~> 0.6.2"])
|
100
100
|
s.add_dependency(%q<rspec>, [">= 0"])
|
101
101
|
s.add_dependency(%q<rake>, ["~> 0.9.2.2"])
|
102
102
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
103
103
|
end
|
104
104
|
else
|
105
|
-
s.add_dependency(%q<activesupport>, ["
|
105
|
+
s.add_dependency(%q<activesupport>, ["> 2.1.0"])
|
106
106
|
s.add_dependency(%q<capybara>, [">= 0"])
|
107
107
|
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
108
108
|
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
109
|
-
s.add_dependency(%q<simplecov>, ["
|
109
|
+
s.add_dependency(%q<simplecov>, ["~> 0.6.2"])
|
110
110
|
s.add_dependency(%q<rspec>, [">= 0"])
|
111
111
|
s.add_dependency(%q<rake>, ["~> 0.9.2.2"])
|
112
112
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -8,19 +8,21 @@ module CapybaraPageObject
|
|
8
8
|
raise MissingPath, "You need to override #path in #{self.class}"
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def root_path
|
12
12
|
'/'
|
13
13
|
end
|
14
14
|
|
15
15
|
def visit_path(attr)
|
16
|
-
target =
|
16
|
+
target = root_path + path
|
17
17
|
if attr.kind_of?(String)
|
18
|
-
target += attr
|
18
|
+
target += '/' + attr
|
19
|
+
elsif attr.kind_of?(Integer)
|
20
|
+
target += '/' + attr.to_s
|
19
21
|
elsif attr.kind_of?(Hash)
|
20
22
|
pairs = attr.map { |k, v| "#{k}=#{v}" }
|
21
23
|
target += '?' + pairs.join('&') if pairs.any?
|
22
24
|
elsif attr != nil
|
23
|
-
raise ArgumentError
|
25
|
+
raise ArgumentError, 'Expected a String, Integer or Hash'
|
24
26
|
end
|
25
27
|
source.visit target
|
26
28
|
end
|
@@ -33,10 +35,10 @@ module CapybaraPageObject
|
|
33
35
|
|
34
36
|
def current?
|
35
37
|
page = new
|
36
|
-
page.source.current_path == page.
|
38
|
+
page.source.current_path == page.root_path + page.path
|
37
39
|
end
|
38
40
|
|
39
|
-
def visit(attr=
|
41
|
+
def visit(attr=nil)
|
40
42
|
page = new
|
41
43
|
page.visit_path(attr)
|
42
44
|
page
|
data/spec/page_spec.rb
CHANGED
@@ -5,11 +5,6 @@ describe "a class which extends CapybaraPageObject::Page" do
|
|
5
5
|
|
6
6
|
before do
|
7
7
|
class FooShow < CapybaraPageObject::Page
|
8
|
-
def path
|
9
|
-
'foos/'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
class FooIndex < CapybaraPageObject::Page
|
13
8
|
def path
|
14
9
|
'foos'
|
15
10
|
end
|
@@ -19,12 +14,12 @@ describe "a class which extends CapybaraPageObject::Page" do
|
|
19
14
|
context ".current?" do
|
20
15
|
it "is true if the path matches the current session path" do
|
21
16
|
Capybara.stub :current_session => mock(:current_path => '/foos')
|
22
|
-
|
17
|
+
FooShow.should be_current
|
23
18
|
end
|
24
19
|
|
25
20
|
it "is false if the path doesn't match the current session path" do
|
26
21
|
Capybara.stub :current_session => mock(:current_path => '/foos/1')
|
27
|
-
|
22
|
+
FooShow.should_not be_current
|
28
23
|
end
|
29
24
|
end
|
30
25
|
|
@@ -33,7 +28,7 @@ describe "a class which extends CapybaraPageObject::Page" do
|
|
33
28
|
session = mock
|
34
29
|
session.should_receive(:visit).with('/foos')
|
35
30
|
Capybara.stub :current_session => session
|
36
|
-
|
31
|
+
FooShow.visit
|
37
32
|
end
|
38
33
|
|
39
34
|
it "throws an error if path hasn't been overridden" do
|
@@ -53,7 +48,7 @@ describe "a class which extends CapybaraPageObject::Page" do
|
|
53
48
|
key_values = ActiveSupport::OrderedHash.new
|
54
49
|
key_values['a'] = 1
|
55
50
|
key_values[:b] = 2
|
56
|
-
@page =
|
51
|
+
@page = FooShow.visit key_values
|
57
52
|
end
|
58
53
|
|
59
54
|
it "converts a supplied string into a resource identifier" do
|
@@ -63,14 +58,21 @@ describe "a class which extends CapybaraPageObject::Page" do
|
|
63
58
|
@page = FooShow.visit 'bar'
|
64
59
|
end
|
65
60
|
|
61
|
+
it "converts a supplied integer into a resource identifier" do
|
62
|
+
session = mock()
|
63
|
+
session.should_receive(:visit).with('/foos/1')
|
64
|
+
Capybara.stub :current_session => session
|
65
|
+
@page = FooShow.visit(1)
|
66
|
+
end
|
67
|
+
|
66
68
|
it "returns an instance of the page object" do
|
67
69
|
Capybara.stub :current_session => stub.as_null_object
|
68
|
-
|
70
|
+
FooShow.visit.class.should == FooShow
|
69
71
|
end
|
70
72
|
|
71
73
|
it "throws an error if the supplied argument is something other a string or hash" do
|
72
74
|
lambda do
|
73
|
-
|
75
|
+
FooShow.visit Object
|
74
76
|
end.should raise_error ArgumentError
|
75
77
|
end
|
76
78
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-page-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>'
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>'
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.1.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: capybara
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bundler
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 1.1.0
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: jeweler
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,21 +69,31 @@ dependencies:
|
|
54
69
|
version: 1.8.3
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.3
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: simplecov
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- -
|
83
|
+
- - ~>
|
64
84
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
85
|
+
version: 0.6.2
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.6.2
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rspec
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: rake
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 0.9.2.2
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.9.2.2
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: rdoc
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ~>
|
@@ -98,7 +133,12 @@ dependencies:
|
|
98
133
|
version: '3.12'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '3.12'
|
102
142
|
description: Page Objects for Capybara
|
103
143
|
email: andy@andywaite.com
|
104
144
|
executables: []
|
@@ -177,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
217
|
version: '0'
|
178
218
|
segments:
|
179
219
|
- 0
|
180
|
-
hash:
|
220
|
+
hash: -2331866822162287834
|
181
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
222
|
none: false
|
183
223
|
requirements:
|
@@ -186,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
226
|
version: '0'
|
187
227
|
requirements: []
|
188
228
|
rubyforge_project:
|
189
|
-
rubygems_version: 1.8.
|
229
|
+
rubygems_version: 1.8.24
|
190
230
|
signing_key:
|
191
231
|
specification_version: 3
|
192
232
|
summary: Page Objects for Capybara
|