acceptance_test 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjA5NTU3MjYwOTRiYzE2ZTI5ZGZmYjljZWFlZjgyYzBlY2Y3OGE3ZQ==
4
+ ZTBiY2I3NjQ3YTcxYzM1Nzc1MWY0OWM1NTVlY2M5NDZiOTljOWU4MA==
5
5
  data.tar.gz: !binary |-
6
- YTBkZDU4N2M0OGIyMzFiMGQxYzA4OTFhMTBlOWZkNDEwNjk2MWY5ZQ==
6
+ YWE4YjZhNWI2MWViZTAzNDY5ZTk0ZDY2OGRhNjUwMzFlYTU3ZTdlYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWE4ZTRlNzQwODUyNTIyNDc3N2UzMWI5NTkyOGU5NTg2YzhiZDFlNzVjMmVi
10
- YzhhZTM5NTNhZWQ4YzI4MWJkNWNkYjViZGZmNThlMWFmY2U3MjYyMDBiZDY4
11
- ODZjYTUyYzc1M2YzZTFhOWJhNDNlZWY3MDkyOTNhZTVhOTQxOGE=
9
+ YjBhZGY2YWVmOGQ0NjQyODRkMjFlNjFkYTg2MGU5YzkzM2RiYjE2MzRmNjQz
10
+ YTQ2NDUxNGZhODAxN2Y4NmZhN2E5NzY4MTc2NmM4YWIxNjBjNWJiN2EzMWZh
11
+ NzhjOGUzMzdmN2I0NzYwZmQzNDkyYmUzMjg1ZTgzMzYzYzVlMTQ=
12
12
  data.tar.gz: !binary |-
13
- YTk1YjM3Y2YxNjI5OTU0NTc4MDE0ODVhNzZkYjQ3NTA4MDQyNmJlYTVhYmEx
14
- NWRiY2EzZTlkZjIzMzNhMjk1NDI1MTViZWI0MTNlYTI0ODhjY2FkMWU1ZWI3
15
- NWFmYTdhNTJiNzNmOTZkNzUyNGM5MDhmZTZjNzI2ZmRmMmNmZDQ=
13
+ YjYwYjNkNTNmZWI0MjBlMjdlZDQyODQyOGIwNWQzZjM1MDY5ZDllNTdmZjc3
14
+ MjNiMTA4MGFmYTdiNGQ0MDVjNzdhODgzYzQ1YzhhNjdkZjJjNzFiMGQ3ZmJm
15
+ ZTNlNjJhMzRmMjg3YjQyOTgwYTcwZWZlMjhjZmZkMDY3ZGJkYzg=
data/CHANGES CHANGED
@@ -75,4 +75,8 @@
75
75
 
76
76
  == Version 1.4.0
77
77
 
78
- * Refactor code to make it simple
78
+ * Refactor code to make it simple
79
+
80
+ == Version 1.4.1
81
+
82
+ * Adding new concepts such as Page and PageSet for building web application representations.
@@ -61,22 +61,6 @@ class AcceptanceTestHelper
61
61
  end
62
62
  end
63
63
 
64
- def metadata_from_scenario scenario
65
- tags = scenario.source_tag_names.collect { |a| a.gsub("@", '') }
66
-
67
- metadata = {}
68
-
69
- if tags.size > 0
70
- tag = tags.first.to_sym
71
-
72
- if AcceptanceTest.supported_drivers.include? tag
73
- metadata[:driver] = tag
74
- end
75
- end
76
-
77
- metadata
78
- end
79
-
80
64
  def get_localhost
81
65
  orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
82
66
 
@@ -0,0 +1,60 @@
1
+ require 'singleton'
2
+
3
+ require 'cucumber/ast/outline_table'
4
+
5
+ class CucumberHelper
6
+ include Singleton
7
+
8
+ def enable_external_source data
9
+ outline_table = Cucumber::Ast::OutlineTable
10
+
11
+ outline_table.class_eval do
12
+ @data = data # class instance variable
13
+
14
+ def self.data # access to class instance variable
15
+ @data
16
+ end
17
+
18
+ def initialize(raw, scenario_outline)
19
+ new_raw = raw
20
+
21
+ name = raw[0][0]
22
+
23
+ if name == 'external_source'
24
+ test_name, parameter_name = raw[1][0].split(":")
25
+
26
+ size = Cucumber::Ast::OutlineTable.data[test_name][parameter_name].size
27
+
28
+ new_raw = Array.new(size+1) {Array.new(1)}
29
+ new_raw[0][0] = parameter_name
30
+
31
+ Cucumber::Ast::OutlineTable.data[test_name][parameter_name].each_with_index do |value, index|
32
+ new_raw[index+1][0] = value
33
+ end
34
+ end
35
+
36
+ super(new_raw)
37
+
38
+ @scenario_outline = scenario_outline
39
+ @cells_class = Cucumber::Ast::OutlineTable::ExampleRow
40
+ init
41
+ end
42
+ end
43
+ end
44
+
45
+ def metadata_from_scenario scenario
46
+ tags = scenario.source_tag_names.collect { |a| a.gsub("@", '') }
47
+
48
+ metadata = {}
49
+
50
+ if tags.size > 0
51
+ tag = tags.first.to_sym
52
+
53
+ if AcceptanceTest.supported_drivers.include? tag
54
+ metadata[:driver] = tag
55
+ end
56
+ end
57
+
58
+ metadata
59
+ end
60
+ end
@@ -0,0 +1,17 @@
1
+ class Page
2
+
3
+ attr_reader :page_set
4
+
5
+ def initialize page_set
6
+ @page_set = page_set
7
+ end
8
+
9
+ def session
10
+ page_set.session
11
+ end
12
+
13
+ def with_session &code
14
+ session.instance_eval &code
15
+ end
16
+
17
+ end
@@ -0,0 +1,34 @@
1
+ require 'forwardable'
2
+
3
+ require 'base/page'
4
+
5
+ class PageSet
6
+ extend Forwardable
7
+
8
+ attr_accessor :session
9
+
10
+ def page
11
+ session
12
+ end
13
+
14
+ def execute &code
15
+ self.instance_eval &code
16
+ end
17
+
18
+ def self.delegate_to_pages *pages
19
+ pages.each do |page|
20
+ class_name = camelize(page.to_s)
21
+ clazz = Object.const_get(class_name)
22
+
23
+ attr_reader page
24
+
25
+ def_delegators page, *(clazz.instance_methods - Page.instance_methods)
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def self.camelize string
32
+ string.split("_").each {|s| s.capitalize! }.join("")
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  class AcceptanceTest
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acceptance_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemspec_deps_gen
@@ -66,6 +66,9 @@ files:
66
66
  - lib/acceptance_test.rb
67
67
  - lib/acceptance_test/acceptance_test.rb
68
68
  - lib/acceptance_test/acceptance_test_helper.rb
69
+ - lib/acceptance_test/cucumber_helper.rb
70
+ - lib/acceptance_test/page.rb
71
+ - lib/acceptance_test/page_set.rb
69
72
  - lib/acceptance_test/screenshot_maker.rb
70
73
  - lib/acceptance_test/version.rb
71
74
  - spec/features/acceptance_config.yml