crabfarm 0.7.5 → 0.7.6

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: decb87d9ee1082ce675625f82fdb1dce0dd20d5c
4
- data.tar.gz: ac81524ae0eb2fb78e3a7a5396523762a10d70c1
3
+ metadata.gz: f600db691271c0d7dd78a27f7f633898a214a5d4
4
+ data.tar.gz: ba15471d773a513f6c85c95c82a714440d6e0889
5
5
  SHA512:
6
- metadata.gz: f5b6e947935dae0b5d45a671bbc81cfd56382bd478155e7ca7c5b9a7fd7499b08c801207167984ec749586dadedd5324f7b4e27c2e8965263ab2e6159450a73d
7
- data.tar.gz: fd65c4389e29b14daeeff2f1014da06eca70cce791e92660127bbbd07332b12b5d3a6defffae3480c40a539f6b91f157aa021a6bfd777921045655a7774435a5
6
+ metadata.gz: 0db51d81848f11823fa281b75910e0cb9a80ce85fa5f8a40582790aaf3b934790f8fd16a80490924939965d6bb0c54285883763ac170b780881b1db729682293
7
+ data.tar.gz: ab93f4e66087874952817102521a95e3df8229dfb518a6daa12b19bb0f58b9b48aebc8014e25f61773351511b105290afa9480758bae0826072d1953487c9f4c
@@ -17,10 +17,12 @@ module Crabfarm
17
17
 
18
18
  def validate_string _value, _options={}
19
19
  fail_with "#{_value} does not match expression" if _options.key? :matches and not _options[:matches] === _value
20
+ fail_with "#{_value} does not contain substring" if _options.key? :contains and !_value.include? _options[:contains]
20
21
  end
21
22
 
22
- def validate_general _value, _options={}
23
+ def validate_general _value, _options={}, &_block
23
24
  fail_with "#{_value} is not recognized" if _options.key? :in and not _options[:in].include? _value
25
+ fail_with "#{_value} is not valid" if _block and !_block.call(_value)
24
26
  end
25
27
 
26
28
  end
@@ -15,48 +15,49 @@ module Crabfarm
15
15
  @context = _context
16
16
  end
17
17
 
18
- def is_integer(_options={})
18
+ def is_integer(_options={}, &_block)
19
19
  perform_assertion(_options) {
20
20
  @value = parse_integer @value, _options
21
21
  validate_number @value, _options
22
- validate_general @value, _options
22
+ validate_general @value, _options, &_block
23
23
  }
24
24
  end
25
25
 
26
26
  alias :is_i :is_integer
27
27
 
28
- def is_float(_options={})
28
+ def is_float(_options={}, &_block)
29
29
  perform_assertion(_options) {
30
30
  @value = parse_float @value, _options
31
31
  validate_number @value, _options
32
- validate_general @value, _options
32
+ validate_general @value, _options, &_block
33
33
  }
34
34
  end
35
35
 
36
36
  alias :is_f :is_float
37
37
 
38
- def is_word(_options={})
38
+ def is_word(_options={}, &_block)
39
39
  perform_assertion(_options) {
40
40
  @value = parse_phrase @value, _options
41
41
  validate_word @value, _options
42
- validate_general @value, _options
42
+ validate_general @value, _options, &_block
43
43
  }
44
44
  end
45
45
 
46
46
  alias :is_w :is_word
47
- def is_string(_options={})
47
+
48
+ def is_string(_options={}, &_block)
48
49
  perform_assertion(_options) {
49
50
  @value = parse_phrase @value, _options
50
51
  validate_string @value, _options
51
- validate_general @value, _options
52
+ validate_general @value, _options, &_block
52
53
  }
53
54
  end
54
55
 
55
56
  alias :is_s :is_string
56
57
 
57
- def is_boolean(_options={})
58
+ def is_boolean(_options={}, &_block)
58
59
  perform_assertion(_options) {
59
- @value = parse_boolean @value, _options
60
+ @value = parse_boolean @value, _options, &_block
60
61
  }
61
62
  end
62
63
 
@@ -4,12 +4,12 @@ gem "crabfarm", '<%= version %>'
4
4
  gem "pincers", '~> 0.7'
5
5
 
6
6
  # Comment this if not using a nokogiri based parser or browser
7
- gem 'nokogiri', "~> 1.6.6"
7
+ gem 'nokogiri', "~> 1.6"
8
8
 
9
9
  # Comment this if not using a selenium webdriver based driver
10
10
  gem "selenium-webdriver", "~> 2.47"
11
11
 
12
12
  group :test do
13
- gem "rspec", "~> 3.3.0"
13
+ gem "rspec", "~> 3.3"
14
14
  gem "rspec-nc"
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Crabfarm
2
- VERSION = "0.7.5"
2
+ VERSION = "0.7.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crabfarm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-06 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport