chop 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/chop/diff.rb +5 -1
- data/lib/chop/dsl.rb +8 -2
- data/lib/chop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8e55d7073955552b6c9a2c84fa3557b155932868f819e383bfbe8e324005f7
|
4
|
+
data.tar.gz: ffc599c2e17422d296c41e1becc4376624d0ed6942107a39f6b37ac74f092c7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bae49072827f854b8d3f82609e91d39cb374d123f12cca8db1b8b2f632076eb355886c00ccb8a8d61eff4d7048501499c45bfed74172879fccef46ca3d78017
|
7
|
+
data.tar.gz: 5741000e0fc3764eadbc01d42ded2118648e380af61651421f73f640e6dd11264d6d895b3e73030d7d5b5400b2696e53124eb821bd9eed09ae6f9e43c349ab5a
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ end
|
|
18
18
|
Chop monkeypatches Cucumber tables with three new methods:
|
19
19
|
|
20
20
|
* `#create!`: Creates entities. Built-in support for ActiveRecord (default) and FactoryGirl, at present.
|
21
|
-
* `#diff!`: Enhances existing method to also accept a CSS selector. Currently supports diffing `<table>`, `<dl>`, `<ul>`, and even `<form>`!.
|
21
|
+
* `#diff!`: Enhances existing method to also accept a capybara element, or a CSS selector pointing to one. Currently supports diffing `<table>`, `<dl>`, `<ul>`, and even `<form>`!.
|
22
22
|
* `#fill_in!`: Fills in a form on the current page.
|
23
23
|
|
24
24
|
All these methods accept blocks for customization.
|
data/lib/chop/diff.rb
CHANGED
@@ -157,7 +157,11 @@ module Chop
|
|
157
157
|
|
158
158
|
def root
|
159
159
|
@root ||= begin
|
160
|
-
|
160
|
+
if selector.is_a?(Capybara::Node::Element)
|
161
|
+
selector
|
162
|
+
else
|
163
|
+
session.find(selector)
|
164
|
+
end
|
161
165
|
rescue Capybara::ElementNotFound
|
162
166
|
raise unless @allow_not_found
|
163
167
|
Node("")
|
data/lib/chop/dsl.rb
CHANGED
@@ -7,7 +7,13 @@ module Chop
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def diff! selector, table, session: Capybara.current_session, as: nil, &block
|
10
|
-
class_name =
|
10
|
+
class_name = if as
|
11
|
+
as.to_s
|
12
|
+
elsif selector.respond_to?(:tag_name)
|
13
|
+
selector.tag_name
|
14
|
+
else
|
15
|
+
session.find(selector).tag_name
|
16
|
+
end.camelize
|
11
17
|
klass = const_get("Chop::#{class_name}")
|
12
18
|
klass.diff! selector, table, session: session, &block
|
13
19
|
end
|
@@ -25,7 +31,7 @@ if defined?(Cucumber::MultilineArgument::DataTable)
|
|
25
31
|
end
|
26
32
|
|
27
33
|
def diff! other_table="table", options={}, &block
|
28
|
-
if other_table.is_a?(String) && !other_table.include?("|")
|
34
|
+
if other_table.respond_to?(:tag_name) || (other_table.is_a?(String) && !other_table.include?("|"))
|
29
35
|
Chop.diff! other_table, self, options, &block
|
30
36
|
else
|
31
37
|
super
|
data/lib/chop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.0.
|
144
|
+
rubygems_version: 3.0.3
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Slice and dice your cucumber tables with ease!
|