test_abstractions 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 414ed93e699b4c8d62df5e641c7ed94f08d9c3bb
4
- data.tar.gz: 9e8da869559368a3cc4dd821d974857c0fca370a
3
+ metadata.gz: 9798a615f745891fc3fc5e470c89fd65d6b8f790
4
+ data.tar.gz: 3653970b01a4e6b76c54d94e2a866b237e7d64d2
5
5
  SHA512:
6
- metadata.gz: 947a6be5ba84e27ba5b94f3b61dfe60d58941368b3fca23039a55039361a412d76b318760c6eae32c4e54c2c56ee7f67f25847eff3233421704b4985a15f403a
7
- data.tar.gz: a5d7665c1f779c548c125f5a5def336d883dcc7c5273fb6540b6a79a7f90458733ec8139860bf1999acd0dd8d5a1b07105e963a44e8e175d959539aba3028a9a
6
+ metadata.gz: 6e0f4d32a45814b83103ad051760f1ae76f88ff5288044b08659cb099bea488c5fde2961bece333bf4dfc28f8a85935e7a61faa987a1990feb58ace83a417263
7
+ data.tar.gz: 2c8e7bb34fe82dd7f2709b9678f424a12fb729b3b900d36b015022634468ebd8c0e22c4c8aab4eaae47d12eb69bfb37baa34e844543aed47523b8325d1daddb0
@@ -9,6 +9,7 @@ require 'capybara/poltergeist'
9
9
  require 'virtus'
10
10
  require 'initializer'
11
11
 
12
+ require 'test_abstractions/session'
12
13
  require 'test_abstractions/client'
13
14
  require 'test_abstractions/configuration'
14
15
  require 'test_abstractions/context'
@@ -17,3 +18,4 @@ require 'test_abstractions/evidence'
17
18
  require 'test_abstractions/fields'
18
19
  require 'test_abstractions/filler'
19
20
  require 'test_abstractions/form'
21
+ require 'test_abstractions/data_object'
@@ -14,18 +14,10 @@ module TestAbstractions
14
14
 
15
15
  def self.build(base_uri: nil, driver: nil)
16
16
  base_uri ||= Context.instance.base_uri
17
- cls = client_class
18
- driver ||= cls.driver
19
- instance = cls.new base_uri, driver
20
- instance
21
- end
17
+ driver = Context.instance.driver
22
18
 
23
- def self.client_class
24
- only_poltergeist_for_now__selenium_would_also_be_useful
25
- end
26
-
27
- def self.only_poltergeist_for_now__selenium_would_also_be_useful
28
- Poltergeist
19
+ instance = new base_uri, driver
20
+ instance
29
21
  end
30
22
 
31
23
  def method_missing(meth, *args, &block)
@@ -36,35 +28,27 @@ module TestAbstractions
36
28
  driver.send meth, *args, &block
37
29
  end
38
30
 
39
- class Poltergeist < Client
40
- extend ::Capybara::DSL
41
-
42
- def self.driver
43
- Capybara::Session.new :poltergeist
44
- end
45
-
46
- def open(uri)
47
- uri = absolute_uri(uri)
48
- driver.visit(uri)
49
- end
31
+ def open(uri)
32
+ uri = absolute_uri(uri)
33
+ driver.visit(uri)
34
+ end
50
35
 
51
- def absolute_uri(uri)
52
- base = URI(base_uri)
53
- u = URI(uri)
54
- (base + u).to_s
55
- end
36
+ def absolute_uri(uri)
37
+ base = URI(base_uri)
38
+ u = URI(uri)
39
+ (base + u).to_s
40
+ end
56
41
 
57
- def enter(content, selector)
58
- driver.fill_in(selector, :with => content)
59
- end
42
+ def enter(content, selector)
43
+ driver.fill_in(selector, :with => content)
44
+ end
60
45
 
61
- def select(option, selector)
62
- driver.select(option, :from => selector)
63
- end
46
+ def select(option, selector)
47
+ driver.select(option, :from => selector)
48
+ end
64
49
 
65
- def click(selector)
66
- click_on(selector)
67
- end
50
+ def click(selector)
51
+ click_on(selector)
68
52
  end
69
53
 
70
54
  module Accessor
@@ -7,6 +7,7 @@ module TestAbstractions
7
7
 
8
8
  class Configuration
9
9
  attr_accessor :base_uri
10
+ attr_accessor :driver_name
10
11
 
11
12
  def self.instance
12
13
  @instance ||= new
@@ -2,15 +2,22 @@ module TestAbstractions
2
2
  class Context
3
3
  include Initializer
4
4
 
5
- initializer :base_uri
5
+ initializer :base_uri, :driver
6
6
 
7
7
  def self.instance
8
8
  @instance ||= build
9
9
  end
10
10
 
11
- def self.build(configuration: nil)
11
+ def self.build(configuration: nil, driver: nil)
12
12
  configuration ||= Configuration.instance
13
- instance = new configuration.base_uri
13
+
14
+ base_uri = configuration.base_uri
15
+
16
+ driver_name = configuration.driver_name
17
+
18
+ driver = Session.build driver_name
19
+
20
+ instance = new base_uri, driver
14
21
  instance
15
22
  end
16
23
  end
@@ -0,0 +1,9 @@
1
+ module TestAbstractions
2
+ class Session
3
+ extend ::Capybara::DSL
4
+
5
+ def self.build(name)
6
+ Capybara::Session.new name
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_abstractions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Bellware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-08 00:00:00.000000000 Z
11
+ date: 2014-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -124,6 +124,7 @@ files:
124
124
  - lib/test_abstractions/fields.rb
125
125
  - lib/test_abstractions/filler.rb
126
126
  - lib/test_abstractions/form.rb
127
+ - lib/test_abstractions/session.rb
127
128
  homepage: https://github.com/sbellware/test_abstractions
128
129
  licenses:
129
130
  - MIT