sapphire 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire/Adapters/Selenium/RubySeleniumWebDriver.rb +4 -3
- data/lib/sapphire/Testing/Coverage/Covers.rb +14 -1
- data/lib/sapphire/Testing/Coverage/Feature.rb +5 -6
- data/lib/sapphire/Testing/Coverage/{BusinessRule.rb → Requirement.rb} +5 -5
- data/lib/sapphire/Testing/Coverage/Test.rb +4 -2
- data/lib/sapphire/version.rb +1 -1
- metadata +9 -9
@@ -141,7 +141,7 @@ module Sapphire
|
|
141
141
|
|
142
142
|
end if array.is_a? Array
|
143
143
|
|
144
|
-
x = self.FindElement array.keys.first, array.fetch(
|
144
|
+
x = self.FindElement array.keys.first, array.fetch(array.keys.first) if array.is_a? Hash
|
145
145
|
return x if x != nil
|
146
146
|
}
|
147
147
|
return element if element != nil
|
@@ -158,18 +158,19 @@ module Sapphire
|
|
158
158
|
if item.is_a? Hash
|
159
159
|
begin
|
160
160
|
x = self.FindElements item.keys.first, item.fetch(item.keys.first)
|
161
|
+
x = nil if x.is_a? Array and x.empty?
|
161
162
|
rescue
|
162
163
|
#do nothing, let it keep looping
|
163
164
|
end
|
164
165
|
end
|
165
166
|
|
166
167
|
x = self.FindElements item[0], item[1] if item.is_a? Array
|
167
|
-
|
168
|
+
x = nil if x.is_a? Array and x.empty?
|
168
169
|
return x if x != nil
|
169
170
|
|
170
171
|
end if array.is_a? Array
|
171
172
|
|
172
|
-
x = self.FindElement array.keys.first, array.fetch(
|
173
|
+
x = self.FindElement array.keys.first, array.fetch(array.keys.first) if array.is_a? Hash
|
173
174
|
return x if x != nil
|
174
175
|
}
|
175
176
|
return element if element != nil
|
@@ -1,7 +1,20 @@
|
|
1
1
|
module Sapphire
|
2
2
|
module Testing
|
3
3
|
module Coverage
|
4
|
-
def Covers(
|
4
|
+
def Covers(hash)
|
5
|
+
token = hash.keys.first
|
6
|
+
target = hash[hash.keys.first]
|
7
|
+
|
8
|
+
if(token == :feature)
|
9
|
+
$current_feature = target
|
10
|
+
elsif(token == :requirement)
|
11
|
+
$current_rule = target
|
12
|
+
elsif(token == :test)
|
13
|
+
feature = $features.select { |f| f.token == $current_feature }[0]
|
14
|
+
requirement = feature.requirements.select { |r| r.token == $current_rule }[0]
|
15
|
+
test = requirement.tests.select { |t| t.token == target }[0]
|
16
|
+
test.is_covered = true
|
17
|
+
end
|
5
18
|
|
6
19
|
end
|
7
20
|
end
|
@@ -9,24 +9,23 @@ module Sapphire
|
|
9
9
|
|
10
10
|
class Feature
|
11
11
|
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :requirements
|
13
13
|
attr_reader :token
|
14
14
|
|
15
15
|
def initialize(token)
|
16
16
|
@token = token
|
17
|
-
@
|
17
|
+
@requirements = []
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
@
|
20
|
+
def AddRequirement(requirement)
|
21
|
+
@requirements << requirement
|
22
22
|
end
|
23
23
|
|
24
24
|
def AddTest(test)
|
25
|
-
@
|
25
|
+
@requirements.last().AddTest test
|
26
26
|
end
|
27
27
|
|
28
28
|
end
|
29
|
-
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module Sapphire
|
2
2
|
module Testing
|
3
3
|
module Coverage
|
4
|
-
def
|
5
|
-
$features.last.
|
4
|
+
def Requirement(hash, &block)
|
5
|
+
$features.last.AddRequirement(Requirement.new(hash))
|
6
|
+
block.call
|
6
7
|
end
|
7
8
|
|
8
|
-
class
|
9
|
+
class Requirement
|
9
10
|
|
10
11
|
attr_reader :token
|
11
12
|
attr_reader :priority
|
12
13
|
attr_reader :tests
|
13
14
|
|
14
|
-
def initialize(hash
|
15
|
+
def initialize(hash)
|
15
16
|
@token = hash.keys.first
|
16
17
|
@priority = hash[hash.keys.first]
|
17
18
|
@tests = []
|
18
|
-
block.call
|
19
19
|
end
|
20
20
|
|
21
21
|
def AddTest(test)
|
data/lib/sapphire/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapphire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &10066392 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10066392
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: colorize
|
27
|
-
requirement: &
|
27
|
+
requirement: &10066140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10066140
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: Platform
|
38
|
-
requirement: &
|
38
|
+
requirement: &10065888 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *10065888
|
47
47
|
description: An automated web acceptance test framework for non-technical resources
|
48
48
|
using selenium-wedriver.
|
49
49
|
email:
|
@@ -146,9 +146,9 @@ files:
|
|
146
146
|
- lib/sapphire/TeamCity/TeamCityReporter.rb
|
147
147
|
- lib/sapphire/TeamCity.rb
|
148
148
|
- lib/sapphire/Testing/ConsoleReporter.rb
|
149
|
-
- lib/sapphire/Testing/Coverage/BusinessRule.rb
|
150
149
|
- lib/sapphire/Testing/Coverage/Covers.rb
|
151
150
|
- lib/sapphire/Testing/Coverage/Feature.rb
|
151
|
+
- lib/sapphire/Testing/Coverage/Requirement.rb
|
152
152
|
- lib/sapphire/Testing/Coverage/Test.rb
|
153
153
|
- lib/sapphire/Testing/Executable.rb
|
154
154
|
- lib/sapphire/Testing/ExpectationException.rb
|