pencil_pusher 0.0.12 → 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/pencil_pusher/form.rb +3 -3
- data/lib/pencil_pusher/have_errors.rb +1 -1
- data/lib/pencil_pusher/have_int_field.rb +3 -2
- data/lib/pencil_pusher/have_required_choice_field.rb +4 -3
- data/lib/pencil_pusher/have_required_field.rb +2 -1
- data/lib/pencil_pusher/have_required_float_field.rb +4 -3
- data/lib/pencil_pusher/have_required_int_field.rb +3 -2
- data/lib/pencil_pusher/have_required_text_field.rb +3 -2
- data/lib/pencil_pusher/have_text_field.rb +2 -1
- data/lib/pencil_pusher/matchers.rb +2 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0940af954a589fa4d7df7d89bf3c26c4bfa00c33
|
4
|
+
data.tar.gz: 1f2c9dfa97fa4ea2666496af80bd5ec61131b767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1607f9debf2a4a68754e17d7c0add1a3953b1640f20fc64509f26dac5e9ea8602d48c8c1272b65e22a9adaaca825759cd3e5d386794aa9c5c2d58c24fe1e7a6a
|
7
|
+
data.tar.gz: e97dc459ea64b6dc600265ca11e942cd964c63f55703cb29b3f6d0d1cc9702d486ddb3bbd1386fdac0e57695931d63acbd72f150e0c89c259740a1e88991cf05
|
data/lib/pencil_pusher/form.rb
CHANGED
@@ -27,7 +27,7 @@ module PencilPusher
|
|
27
27
|
"expected no errors for field #{field_name} but found #{actual.error_messages[field_name]}"
|
28
28
|
end
|
29
29
|
|
30
|
-
alias failure_message failure_message_for_should
|
30
|
+
alias failure_message failure_message_for_should
|
31
31
|
alias failure_message_when_negated failure_message_for_should_not
|
32
32
|
|
33
33
|
def description
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveIntField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_value, error)
|
6
7
|
@field_name = field_name
|
@@ -10,8 +11,8 @@ module PencilPusher
|
|
10
11
|
|
11
12
|
def matches?(builder)
|
12
13
|
begin
|
13
|
-
FormBuilder.form(builder, {field_name => 'here'}).
|
14
|
-
FormBuilder.form(builder, field_name => valid_value).
|
14
|
+
expect(FormBuilder.form(builder, {field_name => 'here'})).to have_errors(field_name, [error])
|
15
|
+
expect(FormBuilder.form(builder, field_name => valid_value)).not_to have_errors(field_name)
|
15
16
|
rescue => e
|
16
17
|
@error = e.message
|
17
18
|
raise e
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveRequiredChoiceField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_values, blank_error, invalid_error)
|
6
7
|
@field_name = field_name
|
@@ -11,11 +12,11 @@ module PencilPusher
|
|
11
12
|
|
12
13
|
def matches?(form)
|
13
14
|
begin
|
14
|
-
form.
|
15
|
+
expect(form).to have_required_field(field_name, blank_error)
|
15
16
|
builder = FormBuilder.builder(form)
|
16
|
-
builder.call(field_name => 'invalid_value').
|
17
|
+
expect(builder.call(field_name => 'invalid_value')).to have_errors(field_name, [invalid_error])
|
17
18
|
valid_values.each do |valid_value|
|
18
|
-
builder.call(field_name => valid_value.to_s).
|
19
|
+
expect(builder.call(field_name => valid_value.to_s)).not_to have_errors(field_name)
|
19
20
|
end
|
20
21
|
rescue => e
|
21
22
|
@error = e.message
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveRequiredField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, error)
|
6
7
|
@field_name = field_name
|
@@ -10,7 +11,7 @@ module PencilPusher
|
|
10
11
|
def matches?(form)
|
11
12
|
begin
|
12
13
|
builder = FormBuilder.builder(form)
|
13
|
-
builder.call(field_name => '').
|
14
|
+
expect(builder.call(field_name => '')).to have_errors(field_name, [error])
|
14
15
|
rescue => e
|
15
16
|
@error = e.message
|
16
17
|
raise e
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveRequiredFloatField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_value, blank_error, invalid_error)
|
6
7
|
@field_name = field_name
|
@@ -11,9 +12,9 @@ module PencilPusher
|
|
11
12
|
|
12
13
|
def matches?(builder)
|
13
14
|
begin
|
14
|
-
builder.
|
15
|
-
FormBuilder.form(builder, {field_name => 'here'}).
|
16
|
-
FormBuilder.form(builder, field_name => valid_value).
|
15
|
+
expect(builder).to have_required_field(field_name, blank_error)
|
16
|
+
expect(FormBuilder.form(builder, {field_name => 'here'})).to have_errors(field_name, [invalid_error])
|
17
|
+
expect(FormBuilder.form(builder, field_name => valid_value)).not_to have_errors(field_name)
|
17
18
|
rescue => e
|
18
19
|
@error = e.message
|
19
20
|
raise e
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveRequiredIntField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_value, blank_error, invalid_error)
|
6
7
|
@field_name = field_name
|
@@ -11,8 +12,8 @@ module PencilPusher
|
|
11
12
|
|
12
13
|
def matches?(builder)
|
13
14
|
begin
|
14
|
-
builder.
|
15
|
-
builder.
|
15
|
+
expect(builder).to have_required_field(field_name, blank_error)
|
16
|
+
expect(builder).to have_int_field(field_name, valid_value, invalid_error)
|
16
17
|
rescue => e
|
17
18
|
@error = e.message
|
18
19
|
raise e
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveRequiredTextField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_value, error)
|
6
7
|
@field_name = field_name
|
@@ -10,8 +11,8 @@ module PencilPusher
|
|
10
11
|
|
11
12
|
def matches?(builder)
|
12
13
|
begin
|
13
|
-
builder.
|
14
|
-
builder.
|
14
|
+
expect(builder).to have_required_field(field_name, error)
|
15
|
+
expect(builder).to have_text_field(field_name, valid_value)
|
15
16
|
rescue => e
|
16
17
|
@error = e.message
|
17
18
|
raise e
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module PencilPusher
|
2
2
|
class HaveTextField
|
3
3
|
include PencilPusher::Matchers
|
4
|
+
include RSpec::Matchers
|
4
5
|
|
5
6
|
def initialize(field_name, valid_value)
|
6
7
|
@field_name = field_name
|
@@ -9,7 +10,7 @@ module PencilPusher
|
|
9
10
|
|
10
11
|
def matches?(builder)
|
11
12
|
begin
|
12
|
-
FormBuilder.form(builder, field_name => valid_value).
|
13
|
+
expect(FormBuilder.form(builder, field_name => valid_value)).not_to have_errors(field_name)
|
13
14
|
rescue => e
|
14
15
|
@error = e.message
|
15
16
|
raise e
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pencil_pusher
|
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
|
- Myles Megyesi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -45,42 +45,42 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.10.
|
48
|
+
version: 0.10.1
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.10.
|
55
|
+
version: 0.10.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 10.
|
62
|
+
version: 10.4.2
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 10.
|
69
|
+
version: 10.4.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 3.1.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 3.1.0
|
84
84
|
description: Form builder and validator
|
85
85
|
email:
|
86
86
|
- myles.megyesi@gmail.com
|