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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a906f7a43719d507256ad88a4cee31836147ca30
4
- data.tar.gz: 6ca18826ff7b99b3c341f80ac6fb7458e627c64f
3
+ metadata.gz: 2a876a6ccfa611381011f04602f493d657034fca
4
+ data.tar.gz: 95bf290db7928b83348729c8e700830b33c1adba
5
5
  SHA512:
6
- metadata.gz: aee8fb422894258e8b3b27b5f0857c4afbf0718d165b29ebbd573b28eca7461fcbde063de73aa27e27d12d2f0d93c201a38697f4a1d3132c478730df3aa13071
7
- data.tar.gz: 74407ef82a46be685a1af7573cd77abd84cb5984d3909a8795824475ab6702bb38faa3c17f79b14f4cfc1133acd716f5b263b94b7bd8d674dfc2ede59bee72ce
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
@@ -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 have_selector selector, text: text
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 have_link text
44
+ expect(page).to have_no_link text
70
45
  else
71
- expect(page).to have_link text, href: pointing_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 have_xpath(image_path(src, text))
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
@@ -1,5 +1,3 @@
1
- require "mackarel/basic_factory"
2
-
3
1
  module Mackarel::Config
4
2
  extend self
5
3
 
@@ -0,0 +1,2 @@
1
+ require "mackarel/factories/basic_factory"
2
+ require "mackarel/factories/factory_girl"
@@ -1,3 +1,3 @@
1
1
  module Mackarel
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/mackarel.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require "mackarel/version"
2
2
  require "mackarel/config"
3
+
3
4
  require "mackarel/core"
4
5
  require "mackarel/capybara"
5
- require "mackarel/factory_girl"
6
+
7
+ require "mackarel/factories"
6
8
 
7
9
  module Mackarel
8
10
  include Core
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.0
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-23 00:00:00.000000000 Z
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/factory_girl.rb
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