elabs_matchers 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elabs_matchers/matchers/be_valid_with.rb +4 -2
- data/lib/elabs_matchers/matchers/contain_hash.rb +4 -2
- data/lib/elabs_matchers/matchers/have_attribute.rb +4 -2
- data/lib/elabs_matchers/matchers/have_fields.rb +4 -2
- data/lib/elabs_matchers/matchers/have_flash.rb +4 -2
- data/lib/elabs_matchers/matchers/have_form_errors_on.rb +4 -2
- data/lib/elabs_matchers/matchers/have_header.rb +4 -2
- data/lib/elabs_matchers/matchers/have_image.rb +4 -2
- data/lib/elabs_matchers/matchers/have_table_row.rb +4 -2
- data/lib/elabs_matchers/matchers/only_include.rb +4 -2
- data/lib/elabs_matchers/matchers/persist.rb +4 -2
- data/lib/elabs_matchers/version.rb +1 -1
- data/spec/spec_helper.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e27ee67b12ccd1b37acf37b7df46e42e5e5c40
|
4
|
+
data.tar.gz: 656f2f6a5dfa7ef3233e99545734a083c0f2bfc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a55afabc835e6d868e4e110b3a67e1da3dda3ba52d140f2f4b1ea8fb95666991ee53888bbc38834eb679993b3f8f52f4cbd1edc3f7bc0d00328fd50f8a0d72f1
|
7
|
+
data.tar.gz: 31527586de412165231fffc6b52771f129d46b53b7830e64d9736e159b4817f51df959a0e14504632bc4cb2336f90ff6d9e1a20257f1a8e10fad87178fd94890
|
@@ -35,13 +35,15 @@ module ElabsMatchers
|
|
35
35
|
self
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def failure_message
|
39
39
|
common_failure_message(:valid)
|
40
40
|
end
|
41
|
+
alias_method :failure_message_for_should, :failure_message
|
41
42
|
|
42
|
-
def
|
43
|
+
def failure_message_when_negated
|
43
44
|
common_failure_message(:invalid)
|
44
45
|
end
|
46
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
45
47
|
|
46
48
|
def description
|
47
49
|
"be valid with #{@values.inspect} as #{@attributes.inspect}"
|
@@ -9,13 +9,15 @@ module ElabsMatchers
|
|
9
9
|
contains?(expected, actual)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def failure_message
|
13
13
|
"Expected #{expected.inspect} to exist in #{actual.inspect} but it did not."
|
14
14
|
end
|
15
|
+
alias_method :failure_message_for_should, :failure_message
|
15
16
|
|
16
|
-
def
|
17
|
+
def failure_message_when_negated
|
17
18
|
"Expected #{expected.inspect} to not exist in #{actual.inspect} but it did."
|
18
19
|
end
|
20
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
19
21
|
|
20
22
|
private
|
21
23
|
|
@@ -17,14 +17,16 @@ module ElabsMatchers
|
|
17
17
|
page.has_no_selector?(selector_type, selector)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
attributes = page.all(:css, "li.wrapper").map(&:text).to_sentence
|
22
22
|
"expected there to be an attribute #{label}: #{value}, but the only attributes were: #{attributes}."
|
23
23
|
end
|
24
|
+
alias_method :failure_message_for_should, :failure_message
|
24
25
|
|
25
|
-
def
|
26
|
+
def failure_message_when_negated
|
26
27
|
"expected there to be no attribute #{label}: #{value}, but there was."
|
27
28
|
end
|
29
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
28
30
|
|
29
31
|
private
|
30
32
|
|
@@ -17,16 +17,18 @@ module ElabsMatchers
|
|
17
17
|
fields.all? { |label, value| page.has_no_field?(label, :with => value) }
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
field_values = page.all("input, textarea").map { |input| input[:value] }
|
22
22
|
|
23
23
|
"expected page to have the fields #{fields.inspect}, but it didn't.
|
24
24
|
The fields on the page had the following values: #{field_values.to_sentence}."
|
25
25
|
end
|
26
|
+
alias_method :failure_message_for_should, :failure_message
|
26
27
|
|
27
|
-
def
|
28
|
+
def failure_message_when_negated
|
28
29
|
"expected page not to have the fields #{fields.inspect}, but it did."
|
29
30
|
end
|
31
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
30
32
|
end
|
31
33
|
|
32
34
|
##
|
@@ -17,13 +17,15 @@ module ElabsMatchers
|
|
17
17
|
page.has_no_selector?(selector_type, selector, :text => message)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
"Expected flash #{type} to be '#{message}' but was '#{page.find(selector_type, selector).text}'."
|
22
22
|
end
|
23
|
+
alias_method :failure_message_for_should, :failure_message
|
23
24
|
|
24
|
-
def
|
25
|
+
def failure_message_when_negated
|
25
26
|
"Expected flash #{type} to not be '#{message}' but it was."
|
26
27
|
end
|
28
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
27
29
|
|
28
30
|
private
|
29
31
|
|
@@ -20,7 +20,7 @@ module ElabsMatchers
|
|
20
20
|
page.has_no_field?(field) || page.find_field(field).has_no_selector?(selector_type, selector, :text => message)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def failure_message
|
24
24
|
if page.has_field?(field)
|
25
25
|
error = page.find_field(field).all(selector_type, selector).first
|
26
26
|
if not error
|
@@ -32,10 +32,12 @@ module ElabsMatchers
|
|
32
32
|
"No such field #{field}."
|
33
33
|
end
|
34
34
|
end
|
35
|
+
alias_method :failure_message_for_should, :failure_message
|
35
36
|
|
36
|
-
def
|
37
|
+
def failure_message_when_negated
|
37
38
|
"Expected error message on '#{field}' not to be '#{message}' but it was."
|
38
39
|
end
|
40
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
39
41
|
|
40
42
|
private
|
41
43
|
|
@@ -17,14 +17,16 @@ module ElabsMatchers
|
|
17
17
|
page.has_no_selector?(selector_type, selector, :text => text)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
headers = page.all(selector_type, selector).map { |h| "'#{h.text}'" }.to_sentence
|
22
22
|
"Expected header to be '#{text}' but it had the headers #{headers}."
|
23
23
|
end
|
24
|
+
alias_method :failure_message_for_should, :failure_message
|
24
25
|
|
25
|
-
def
|
26
|
+
def failure_message_when_negated
|
26
27
|
"Expected header not to be '#{text}' but it was."
|
27
28
|
end
|
29
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
28
30
|
|
29
31
|
private
|
30
32
|
|
@@ -17,7 +17,7 @@ module ElabsMatchers
|
|
17
17
|
page.has_no_selector?(selector_type, selector)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
images = page.all("img").map do |image|
|
22
22
|
hash = {}
|
23
23
|
hash[:alt] = image[:alt] if image[:alt].present?
|
@@ -33,10 +33,12 @@ module ElabsMatchers
|
|
33
33
|
"expected to find image '#{value}' but only had the images: #{images}."
|
34
34
|
end
|
35
35
|
end
|
36
|
+
alias_method :failure_message_for_should, :failure_message
|
36
37
|
|
37
|
-
def
|
38
|
+
def failure_message_when_negated
|
38
39
|
"expected image not to be '#{value}' but it was."
|
39
40
|
end
|
41
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
40
42
|
|
41
43
|
private
|
42
44
|
|
@@ -17,13 +17,15 @@ module ElabsMatchers
|
|
17
17
|
!table or table.has_no_selector?(selector_type, selector)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def failure_message
|
21
21
|
"Expected #{row.inspect} to be included in the table #{table_name}, but it wasn't:\n\n#{ascii_table}"
|
22
22
|
end
|
23
|
+
alias_method :failure_message_for_should, :failure_message
|
23
24
|
|
24
|
-
def
|
25
|
+
def failure_message_when_negated
|
25
26
|
"Expected there to be no table #{table_name} with row #{row.inspect}, but there was.\n\n#{ascii_table}"
|
26
27
|
end
|
28
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
27
29
|
|
28
30
|
private
|
29
31
|
|
@@ -13,13 +13,15 @@ module ElabsMatchers
|
|
13
13
|
elements.all? { |element| actual.include?(element) }
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def failure_message
|
17
17
|
"Expected #{actual.inspect} to only include #{elements.inspect}."
|
18
18
|
end
|
19
|
+
alias_method :failure_message_for_should, :failure_message
|
19
20
|
|
20
|
-
def
|
21
|
+
def failure_message_when_negated
|
21
22
|
"Expected #{actual.inspect} to not only include #{elements.inspect}, but it did."
|
22
23
|
end
|
24
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
23
25
|
end
|
24
26
|
|
25
27
|
##
|
@@ -15,13 +15,15 @@ module ElabsMatchers
|
|
15
15
|
@final_value == value
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def failure_message
|
19
19
|
"Expected #{attribute} to be persisted and retain its value of #{value.inspect} but the value was #{@final_value.inspect}."
|
20
20
|
end
|
21
|
+
alias_method :failure_message_for_should, :failure_message
|
21
22
|
|
22
|
-
def
|
23
|
+
def failure_message_when_negated
|
23
24
|
"Expected #{attribute} not to be persisted and retain its value of #{value.inspect} but it did."
|
24
25
|
end
|
26
|
+
alias_method :failure_message_for_should_not, :failure_message_when_negated
|
25
27
|
end
|
26
28
|
|
27
29
|
##
|
data/spec/spec_helper.rb
CHANGED
@@ -6,10 +6,20 @@ require "capybara"
|
|
6
6
|
require "active_model"
|
7
7
|
require "elabs_matchers"
|
8
8
|
|
9
|
+
I18n.enforce_available_locales = true
|
10
|
+
|
9
11
|
RSpec.configure do |config|
|
10
12
|
config.mock_with :rspec
|
11
13
|
config.include Capybara::DSL
|
12
14
|
|
15
|
+
config.expect_with :rspec do |c|
|
16
|
+
c.syntax = [:should, :expect]
|
17
|
+
end
|
18
|
+
|
19
|
+
config.mock_with :rspec do |c|
|
20
|
+
c.syntax = [:should, :expect]
|
21
|
+
end
|
22
|
+
|
13
23
|
%w[helpers matchers].each do |dir|
|
14
24
|
Dir[File.join(File.expand_path(File.dirname(__FILE__)), "../lib/elabs_matchers/#{dir}/*.rb")].each do |file|
|
15
25
|
file = file.split("/").last.split(".").first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elabs_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Everyone at Elabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -288,3 +288,4 @@ test_files:
|
|
288
288
|
- spec/fixtures/file.txt
|
289
289
|
- spec/fixtures/post.rb
|
290
290
|
- spec/spec_helper.rb
|
291
|
+
has_rdoc:
|