page_magic 1.0.0.alpha8 → 1.0.0.alpha9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfda87e1bb18198d7cd95b36a339ff68be3cf778
4
- data.tar.gz: 3d95a82ed45417528a116e49ee141a30b0537d41
3
+ metadata.gz: 913ffb021a5d651dd495d38676e28a3db2d0f51d
4
+ data.tar.gz: b61ef053d8a6de10e24386904f5e469f5a34e72e
5
5
  SHA512:
6
- metadata.gz: 2bfc886d3de8e0a2ae4993c9820eee29cff4816663a9dd55891d55ebf221a6fbb046f838e38c85873f59e158a072160a08c149eddd3dc24297c4ec0d95be64c1
7
- data.tar.gz: 908fcba5e372276d9d0729cba67d093d0bdeb50c42f598c7eb7f34ebf461e20f969e871be7def748e69901313ff894d949ba93a9147100100a4f7b1439508311
6
+ metadata.gz: ae0c743e1683f12841c77ba81d53ebe985faedbf0cd71d9560abe898a6b7f5473feb4ac256c58e8d1f2b3998843a32b7bc3665cc414e88f9502f584c832d86ef
7
+ data.tar.gz: 48d8d12ad1dbb5008987e0fca4a78b897c84001826a72069ecf605b3412cb4c89c809473e0ad77168757ca236ef2ebbbdca967449b6319b42598f680d73be08f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.alpha8
1
+ 1.0.0.alpha9
@@ -11,9 +11,7 @@ module PageMagic
11
11
  end
12
12
 
13
13
  def build(app, browser:, options:{})
14
- options[:browser] = browser
15
- driver_clazz = handler.call
16
- driver_clazz.new(app, options)
14
+ handler.call(app, options, browser)
17
15
  end
18
16
  end
19
17
  end
@@ -1,8 +1,8 @@
1
1
  module PageMagic
2
2
  class Drivers
3
- Poltergeist = Driver.new(:poltergeist) do
3
+ Poltergeist = Driver.new(:poltergeist) do |app, options|
4
4
  require 'capybara/poltergeist'
5
- Capybara::Poltergeist::Driver
5
+ Capybara::Poltergeist::Driver.new(app, options)
6
6
  end
7
7
  end
8
8
  end
@@ -1,7 +1,7 @@
1
1
  module PageMagic
2
2
  class Drivers
3
- RackTest = Driver.new(:rack_test) do
4
- Capybara::RackTest::Driver
3
+ RackTest = Driver.new(:rack_test) do |app, options|
4
+ Capybara::RackTest::Driver.new(app, options)
5
5
  end
6
6
  end
7
7
  end
@@ -1,8 +1,8 @@
1
1
  module PageMagic
2
2
  class Drivers
3
- Selenium = Driver.new(:chrome, :firefox) do
3
+ Selenium = Driver.new(:chrome, :firefox) do |app, options, browser|
4
4
  require 'watir-webdriver'
5
- Capybara::Selenium::Driver
5
+ Capybara::Selenium::Driver.new(app, options.dup.merge(browser: browser))
6
6
  end
7
7
  end
8
8
  end
@@ -2,23 +2,8 @@ require 'page_magic/driver'
2
2
 
3
3
  module PageMagic
4
4
  describe Driver do
5
- let(:driver_class) do
6
- Class.new do
7
- attr_reader :rack_app, :options
8
- def initialize(rack_app, options)
9
- @rack_app = rack_app
10
- @options = options
11
- end
12
-
13
- def ==(driver)
14
- driver.rack_app == rack_app && driver.options == options
15
- end
16
- end
17
- end
18
5
  subject do
19
- described_class.new :custom_browser do
20
- driver_class
21
- end
6
+ described_class.new :custom_browser
22
7
  end
23
8
 
24
9
  describe '#supports?' do
@@ -35,12 +20,22 @@ module PageMagic
35
20
  end
36
21
  end
37
22
  describe '#build' do
38
- it 'adds the browser to the options supplied to the driver' do
39
- expect(subject.build(:rack_app, browser: :custom_browser, options: {}).options).to eq(browser: :custom_browser)
23
+
24
+ it 'returns the result of the block passed to the driver class constructor' do
25
+ subject = described_class.new(:custom_browser)do
26
+ :driver
27
+ end
28
+ expect(subject.build(:rack_app, browser: :custom_browser, options: :options)).to eq(:driver)
40
29
  end
41
30
 
42
- it 'creates an instance of the supplied driver' do
43
- expect(subject.build(:rack_app, browser: :custom_browser, options: {})).to eq(driver_class.new(:rack_app, browser: :custom_browser))
31
+ it 'passes rack app to the handler' do
32
+ subject = described_class.new(:custom_browser) do |app, options, browser|
33
+ expect(app).to eq(:rack_app)
34
+ expect(options).to eq(:options)
35
+ expect(browser).to eq(:browser)
36
+ end
37
+
38
+ subject.build(:rack_app, options: :options, browser: :browser)
44
39
  end
45
40
  end
46
41
  end
@@ -2,9 +2,16 @@ require 'page_magic/drivers/selenium'
2
2
  module PageMagic
3
3
  class Drivers
4
4
  describe Selenium do
5
+ subject do
6
+ described_class.build(:app, browser: :selenium, options: {})
7
+ end
8
+
5
9
  it 'is selenium' do
6
- driver = described_class.build(:app, browser: :selenium, options: {})
7
- expect(driver).to be_a(Capybara::Selenium::Driver)
10
+ expect(subject).to be_a(Capybara::Selenium::Driver)
11
+ end
12
+
13
+ it 'sets the browser option' do
14
+ expect(subject.options[:browser]).to be(:selenium)
8
15
  end
9
16
  end
10
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha8
4
+ version: 1.0.0.alpha9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Davis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara