sapphire 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ require 'win32ole'
9
9
  require 'json'
10
10
 
11
11
  Dir[File.dirname(__FILE__) + '/sapphire/Testing/*.rb'].each {|file| require file }
12
+ Dir[File.dirname(__FILE__) + '/sapphire/Configuration/*.rb'].each {|file| require file }
12
13
  Dir[File.dirname(__FILE__) + '/sapphire/WebAbstractions/Controls/Base/*.rb'].each {|file| require file }
13
14
  Dir[File.dirname(__FILE__) + '/sapphire/WebAbstractions/Controls/*.rb'].each {|file| require file }
14
15
  Dir[File.dirname(__FILE__) + '/sapphire/DataAbstractions/*.rb'].each {|file| require file }
@@ -23,6 +24,8 @@ module Sapphire
23
24
  include DSL::Browser
24
25
  include DSL::Configuration
25
26
  include DSL::Data
27
+ include Configuration::AttrMethods
28
+ include Configuration
26
29
  include DataAbstractions
27
30
  include WebAbstractions
28
31
  include Testing
@@ -0,0 +1,39 @@
1
+ # Taken this class from Albacore
2
+
3
+ module Sapphire
4
+ module Configuration
5
+ module AttrMethods
6
+ def attr_array(*names)
7
+ names.each do |n|
8
+ self.send :define_method, n do |*value|
9
+ if value.nil? || value.empty?
10
+ return instance_variable_get("@#{n}")
11
+ else
12
+ self.send "#{n}=".to_sym, value.to_ary.flatten
13
+ end
14
+ end
15
+ self.send :define_method, "#{n}=" do |value|
16
+ instance_variable_set("@#{n}", value)
17
+ end
18
+ end
19
+ end
20
+
21
+ def attr_hash(*names)
22
+ names.each do |n|
23
+ self.class_eval(<<-EOF, __FILE__, __LINE__)
24
+ def #{n}(*value)
25
+ if value.nil? || value.empty?
26
+ instance_variable_get("@#{n}")
27
+ else
28
+ instance_variable_set("@#{n}", value[0])
29
+ end
30
+ end
31
+ EOF
32
+ self.send :define_method, "#{n}=" do |value|
33
+ instance_variable_set("@#{n}", value)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path('attrmethods', File.dirname(__FILE__))
2
+ require 'ostruct'
3
+
4
+ module Sapphire
5
+ module Configuration
6
+ class Config < OpenStruct
7
+
8
+ def self.create(hash)
9
+ @@instance ||= AppConfig.new hash
10
+ @@instance
11
+ end
12
+
13
+ def self.Current
14
+ @@instance
15
+ end
16
+
17
+ def Browser
18
+ case($config["Browser"])
19
+ when "Firefox" then FireFoxBrowser.new
20
+ when "Chrome" then ChromeBrowser.new
21
+ when "IE" then InternetExplorerBrowser.new
22
+ end
23
+ end
24
+
25
+ def ConfiguredBrowser
26
+ $config["Browser"]
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: albacore
16
- requirement: &9555948 !ruby/object:Gem::Requirement
16
+ requirement: &9564060 !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: *9555948
24
+ version_requirements: *9564060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: selenium-webdriver
27
- requirement: &9555528 !ruby/object:Gem::Requirement
27
+ requirement: &9563568 !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: *9555528
35
+ version_requirements: *9563568
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &9555084 !ruby/object:Gem::Requirement
38
+ requirement: &9563148 !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: *9555084
46
+ version_requirements: *9563148
47
47
  description: An automated web acceptance test framework for non-technical resources
48
48
  using selenium-wedriver.
49
49
  email:
@@ -52,6 +52,8 @@ executables: []
52
52
  extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
+ - lib/sapphire/Configuration/AttrMethods.rb
56
+ - lib/sapphire/Configuration/Config.rb
55
57
  - lib/sapphire/DataAbstractions/Database.rb
56
58
  - lib/sapphire/DataAbstractions/NonQuery.rb
57
59
  - lib/sapphire/DataAbstractions/Query.rb