acceptance_test 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/lib/acceptance_test/page_set.rb +31 -21
- data/lib/acceptance_test/version.rb +1 -1
- data/spec/support/steps/search_with_pages_steps.rb +2 -2
- data/spec/wikipedia_search_with_pages_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae34aa2cd47d1bbb0ef858917ccf9e96abfb287e
|
4
|
+
data.tar.gz: 74123d56a4ce80ecfb91b7c1fde908c27f26971e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5a59e5fd6d988910c8c186f72020fd57a435ff4f3214657a4ad8246f243ac12f0151642cd00eb2fd3a79d981db815c5bcc358c4304ce7a172531f42fd0cd6f9
|
7
|
+
data.tar.gz: 9b4be35e79cede77d65861eee17214c846c9e931666aba0760118e265d58ade32126e43f099e8c2799f5606703da40820a56b8991ee693d4aa704764fe97fc50
|
data/CHANGES
CHANGED
@@ -6,15 +6,19 @@ class PageSet
|
|
6
6
|
extend Forwardable
|
7
7
|
|
8
8
|
attr_reader :pages
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :context
|
10
10
|
|
11
|
-
def initialize
|
12
|
-
@
|
11
|
+
def initialize context
|
12
|
+
@context = context
|
13
13
|
@pages = []
|
14
14
|
end
|
15
15
|
|
16
|
-
def page
|
17
|
-
|
16
|
+
# def page
|
17
|
+
# context.page
|
18
|
+
# end
|
19
|
+
|
20
|
+
def session
|
21
|
+
context.page
|
18
22
|
end
|
19
23
|
|
20
24
|
def execute &code
|
@@ -28,7 +32,7 @@ class PageSet
|
|
28
32
|
end
|
29
33
|
|
30
34
|
def delegate_to_page page
|
31
|
-
|
35
|
+
pages << page
|
32
36
|
|
33
37
|
self.class.send :attr_reader, page
|
34
38
|
|
@@ -41,25 +45,31 @@ class PageSet
|
|
41
45
|
clazz.instance_methods - Page.instance_methods
|
42
46
|
end
|
43
47
|
|
44
|
-
def enable_smart_completion
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
48
|
+
def enable_smart_completion
|
49
|
+
context.class.send(:define_method, :method_missing) do |method_name, *args, &block|
|
50
|
+
page_set.send method_name, *args, &block
|
51
|
+
end
|
49
52
|
|
50
|
-
|
53
|
+
page_set = self
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
method = page_set.method(method_name)
|
55
|
+
PageSet.class_eval do
|
56
|
+
@page_set = page_set # class instance variable
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
def self.page_set # access to class instance variable
|
59
|
+
@page_set
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
pages.each do |page|
|
64
|
+
page_methods(page).each do |method_name|
|
65
|
+
method = page_set.method(method_name)
|
66
|
+
|
67
|
+
context.class.step "I #{method_name.to_s.gsub('_', ' ')}" do |*args|
|
68
|
+
page_set.send method_name, *args
|
69
|
+
end
|
59
70
|
|
60
|
-
|
61
|
-
|
62
|
-
end
|
71
|
+
context.class.step "#{method.to_s.gsub('_', ' ')}" do
|
72
|
+
page_set.send method_name, *args
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
@@ -9,9 +9,9 @@ steps_for :search_with_pages do
|
|
9
9
|
step "I am within wikipedia.com" do
|
10
10
|
puts Capybara.current_driver
|
11
11
|
|
12
|
-
@page_set = WikipediaPages.new(
|
12
|
+
@page_set = WikipediaPages.new(self)
|
13
13
|
|
14
|
-
page_set.enable_smart_completion
|
14
|
+
page_set.enable_smart_completion
|
15
15
|
end
|
16
16
|
|
17
17
|
step :visit_home_page, "I am on wikipedia.com"
|