mackarel 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mackarel/capybara/form.rb +30 -0
- data/lib/mackarel/capybara.rb +12 -31
- data/lib/mackarel/config.rb +0 -2
- data/lib/mackarel/{basic_factory.rb → factories/basic_factory.rb} +0 -0
- data/lib/mackarel/{factory_girl.rb → factories/factory_girl.rb} +0 -0
- data/lib/mackarel/factories.rb +2 -0
- data/lib/mackarel/version.rb +1 -1
- data/lib/mackarel.rb +3 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a876a6ccfa611381011f04602f493d657034fca
|
4
|
+
data.tar.gz: 95bf290db7928b83348729c8e700830b33c1adba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc34f92ca95d8a854eb05c7cb2843ab40155bbfcc601f05c93d60127ec8061e837c70a369d6014e7f4002c0608cbc75a87ae469edd23968d2e2b5229c03cfbf8
|
7
|
+
data.tar.gz: 6ea8ca19c4e98f05fe5b8630fd5500c8e7864404f5148f959800302de4b683c94a03b1c1a876339923e164bd8dd3ddfd665c91b06b4ec125102fe8e0111fb624
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Mackarel
|
2
|
+
module Capybara
|
3
|
+
def fill_the_form_with(attributes)
|
4
|
+
attributes.each do |field_name, value|
|
5
|
+
field = page.find_field(field_name)
|
6
|
+
next if field.set(value)
|
7
|
+
select_on_form(field_name, value)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fill_autocomplete(field="input[data-autocomplete]", options)
|
12
|
+
fill_in field, with: options.delete(:with)
|
13
|
+
page.execute_script %Q{ $('#{field}').trigger("focus") }
|
14
|
+
page.execute_script %Q{ $('#{field}').trigger("keydown") }
|
15
|
+
sleep 1
|
16
|
+
page.execute_script %Q{ $('.ui-menu-item a:contains("#{with}")').trigger("mouseenter").trigger("click"); }
|
17
|
+
end
|
18
|
+
|
19
|
+
def select_on_form(field_name, value)
|
20
|
+
field = page.find_field(field_name)
|
21
|
+
[value].flatten.each do |single_value|
|
22
|
+
field.find(:option, single_value).select_option
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def submit_the_form(selector="")
|
27
|
+
page.find("form#{selector}").find(:button).click
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/mackarel/capybara.rb
CHANGED
@@ -1,32 +1,7 @@
|
|
1
|
+
require "mackarel/capybara/form"
|
2
|
+
|
1
3
|
module Mackarel
|
2
4
|
module Capybara
|
3
|
-
def fill_the_form_with(attributes)
|
4
|
-
attributes.each do |field_name, value|
|
5
|
-
field = page.find_field(field_name)
|
6
|
-
next if field.set(value)
|
7
|
-
select_on_form(field_name, value)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def fill_autocomplete(field="input[data-autocomplete]", options)
|
12
|
-
fill_in field, with: options.delete(:with)
|
13
|
-
page.execute_script %Q{ $('#{field}').trigger("focus") }
|
14
|
-
page.execute_script %Q{ $('#{field}').trigger("keydown") }
|
15
|
-
sleep 1
|
16
|
-
page.execute_script %Q{ $('.ui-menu-item a:contains("#{with}")').trigger("mouseenter").trigger("click"); }
|
17
|
-
end
|
18
|
-
|
19
|
-
def select_on_form(field_name, value)
|
20
|
-
field = page.find_field(field_name)
|
21
|
-
[value].flatten.each do |single_value|
|
22
|
-
field.find(:option, single_value).select_option
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def submit_the_form(selector="")
|
27
|
-
page.find("form#{selector}").find(:button).click
|
28
|
-
end
|
29
|
-
|
30
5
|
def i_am_taken_to(path)
|
31
6
|
expect(current_path).to eq path
|
32
7
|
end
|
@@ -62,17 +37,17 @@ module Mackarel
|
|
62
37
|
text = opts.delete(:with_text)
|
63
38
|
case selector
|
64
39
|
when String
|
65
|
-
expect(page).to
|
40
|
+
expect(page).to have_no_selector selector, text: text
|
66
41
|
when :link
|
67
42
|
pointing_to = opts.delete(:pointing_to)
|
68
43
|
if pointing_to.nil?
|
69
|
-
expect(page).to
|
44
|
+
expect(page).to have_no_link text
|
70
45
|
else
|
71
|
-
expect(page).to
|
46
|
+
expect(page).to have_no_link text, href: pointing_to
|
72
47
|
end
|
73
48
|
when :image
|
74
49
|
src = opts.delete(:with_src)
|
75
|
-
expect(page).to
|
50
|
+
expect(page).to have_no_xpath(image_path(src, text))
|
76
51
|
end
|
77
52
|
end
|
78
53
|
|
@@ -104,6 +79,12 @@ module Mackarel
|
|
104
79
|
alias and_i_find_an i_find
|
105
80
|
alias and_i_find_a i_find
|
106
81
|
|
82
|
+
alias and_i_find_no i_find_no
|
83
|
+
alias i_dont_find_a i_find_no
|
84
|
+
alias i_dont_find_an i_find_no
|
85
|
+
alias and_i_dont_find_an i_find_no
|
86
|
+
alias and_i_dont_find_a i_find_no
|
87
|
+
|
107
88
|
alias and_i_can_see i_can_see
|
108
89
|
end
|
109
90
|
end
|
data/lib/mackarel/config.rb
CHANGED
File without changes
|
File without changes
|
data/lib/mackarel/version.rb
CHANGED
data/lib/mackarel.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mackarel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Gianrossi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -270,11 +270,13 @@ files:
|
|
270
270
|
- bin/setup
|
271
271
|
- features.rb
|
272
272
|
- lib/mackarel.rb
|
273
|
-
- lib/mackarel/basic_factory.rb
|
274
273
|
- lib/mackarel/capybara.rb
|
274
|
+
- lib/mackarel/capybara/form.rb
|
275
275
|
- lib/mackarel/config.rb
|
276
276
|
- lib/mackarel/core.rb
|
277
|
-
- lib/mackarel/
|
277
|
+
- lib/mackarel/factories.rb
|
278
|
+
- lib/mackarel/factories/basic_factory.rb
|
279
|
+
- lib/mackarel/factories/factory_girl.rb
|
278
280
|
- lib/mackarel/version.rb
|
279
281
|
- mackarel.gemspec
|
280
282
|
homepage: https://github.com/paologianrossi/mackarel
|