conformity 0.0.8 → 0.0.9

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: 7b8455307bec73a30aafcac8703555a260a59683
4
- data.tar.gz: 740f87bd8c214605fdd86d611d0c24306704a2a0
3
+ metadata.gz: e405b329514c0569897e41ff7e62a3b7d67e552b
4
+ data.tar.gz: 2580059337a97a3d998c400dc0450d1b90544004
5
5
  SHA512:
6
- metadata.gz: 6a957db00a62c401b20343edfd5dd308f51fe518c600a4f866aea68ff7a7c7725507b574b2f9fab3c068f46b09231c46cd9bdc6ccf7344d88cea84eab11f7537
7
- data.tar.gz: 571371f18eb5df39db3f92575ff8b9fe775275967f3b3529432ec9337b0b53602fb65dfe17d21709cedc098eefe0dc73657930cae736182de3a9d446eaafddc5
6
+ metadata.gz: bb1593b4682f3d2a468cd73b66ca56b42772cc1048921cf333e1ceab75f52acdeeb935f06bf3683608b1c9d453cb0d070a18769bb14db2f1e14fac91ba20efc1
7
+ data.tar.gz: 7f522be5f5bbd0dcd1abbd2dbb95a673c923fe10fdd201dcf46005eb2327ae982a5af5b40fe75695147ce575c85c0b508db82de35ff1897e14bb06472e62808c
@@ -15,45 +15,71 @@ module Conformity
15
15
  end
16
16
 
17
17
  def click_on(locator, options={})
18
- session.find(locator, options).click
19
- screenshot(name) if Conformity.log_screenshots
18
+ begin
19
+ session.click_on(locator, options)
20
+ rescue Capybara::ElementNotFound
21
+ session.find(locator, options).click
22
+ end
23
+ screenshot(:click_on) if Conformity.log_screenshots
20
24
  end
21
- alias_method :click_link_or_button, :click_on
22
- alias_method :click_link, :click_on
23
- alias_method :click_button, :click_on
24
25
 
25
26
  def fill_in(locator, options={})
26
- raise "Must pass a hash containing 'with'" if not options.is_a?(Hash) or not options.has_key?(:with)
27
- with = options.delete(:with)
28
- fill_options = options.delete(:fill_options)
29
- session.find(locator, options).set(with, fill_options)
27
+ begin
28
+ dup = options.dup
29
+ session.fill_in(locator, dup)
30
+ rescue Capybara::ElementNotFound
31
+ raise "Must pass a hash containing 'with'" if not options.is_a?(Hash) or not options.has_key?(:with)
32
+ with = options.delete(:with)
33
+ fill_options = options.delete(:fill_options)
34
+ session.find(locator, options).set(with)
35
+ end
30
36
  screenshot(:fill_in) if Conformity.log_screenshots
31
37
  end
32
38
 
33
39
  def choose(locator, options={})
34
- session.find(locator, options).set(true)
40
+ begin
41
+ session.choose(locator, options)
42
+ rescue Capybara::ElementNotFound
43
+ session.find(locator, options).set(true)
44
+ end
35
45
  screenshot(:choose) if Conformity.log_screenshots
36
46
  end
37
47
 
38
48
  def check(locator, options={})
39
- session.find(locator, options).set(true)
49
+ begin
50
+ session.check(locator, options)
51
+ rescue Capybara::ElementNotFound
52
+ session.find(locator, options).set(true)
53
+ end
40
54
  screenshot(:check) if Conformity.log_screenshots
41
55
  end
42
56
 
43
57
  def uncheck(locator, options={})
44
- session.find(locator, options).set(false)
58
+ begin
59
+ session.uncheck(locator, options)
60
+ rescue Capybara::ElementNotFound
61
+ session.find(locator, options).set(false)
62
+ end
45
63
  screenshot(:uncheck) if Conformity.log_screenshots
46
64
  end
47
65
 
48
66
  def select(value, options={})
49
- options.delete(:from)
50
- session.find(value, options).select_option
67
+ begin
68
+ session.select(value, options)
69
+ rescue Capybara::ElementNotFound
70
+ options.delete(:from)
71
+ session.find(value, options).select_option
72
+ end
51
73
  screenshot(:select) if Conformity.log_screenshots
52
74
  end
53
75
 
54
76
  def unselect(value, options={})
55
- options.delete(:from)
56
- session.find(value, options).unselect_option
77
+ begin
78
+ session.unselect(value, options)
79
+ rescue Capybara::ElementNotFound
80
+ options.delete(:from)
81
+ session.find(value, options).unselect_option
82
+ end
57
83
  screenshot(:unselect) if Conformity.log_screenshots
58
84
  end
59
85
 
@@ -34,11 +34,7 @@ module Conformity
34
34
  Capybara.current_session.reset!
35
35
  set_host(host)
36
36
 
37
- begin
38
- actions.instance_eval(&steps)
39
- rescue => e
40
- raise FillError, "#{e.message}"
41
- end
37
+ actions.instance_eval(&steps)
42
38
  Capybara.page
43
39
  end
44
40
 
@@ -1,3 +1,3 @@
1
1
  module Conformity
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/conformity.rb CHANGED
@@ -18,7 +18,6 @@ module Conformity
18
18
  class ConformityError < StandardError; end
19
19
  class ActionError < ConformityError; end
20
20
  class FieldError < ConformityError; end
21
- class FillError < ConformityError; end
22
21
 
23
22
  class << self
24
23
  attr_writer :log_screenshots
data/spec/form_spec.rb CHANGED
@@ -42,13 +42,13 @@ describe Form do
42
42
  skip "test not implemented"
43
43
  end
44
44
 
45
- it 'raises FillError on failure' do
45
+ it 'raises error on failure' do
46
46
  form = Form.new do
47
47
  fill_in 'name', with: field(:name)
48
48
  click_on 'submit'
49
49
  end
50
50
 
51
- expect { form.fill_with(name: 'Jane Doe') }.to raise_error(FillError)
51
+ expect { form.fill_with(name: 'Jane Doe') }.to raise_error
52
52
  end
53
53
  end
54
54
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conformity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikias Kalpaxis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara