pr 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/features/building_forms_from_hashes.feature +31 -0
- data/features/support/dsl.rb +22 -12
- data/lib/pr/form.rb +2 -2
- data/lib/pr/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dabd9d8c21b3c850b57cde93687b312cba5e9946
|
4
|
+
data.tar.gz: 5e58afda498dd0c2c8f64d44800ebf6ef6610884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac666293f13a93bf37b9c89f0fb582567d9a707633040384ada6fbc872ca6e2e981a9b706326a31424bed48f20c49a548c07a7ae0b3aeea1425e163938531728
|
7
|
+
data.tar.gz: fe28ee1ca371b167ebcec05173608ea68e0193d7b7538cb5a9e9235ce5ac7bc956ec4224c6bde457c6a0f9858a432878b05aee322abd90e3c7340dd65deb7c90
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -55,3 +55,34 @@ Feature: Building a form from a hash
|
|
55
55
|
"""
|
56
56
|
Then my form should have a event_name of "Mien Event"
|
57
57
|
Then my form should have a start_date of "31/03/2013"
|
58
|
+
|
59
|
+
@form @macro @hash @args
|
60
|
+
Scenario: Basic Form built using macro with arguments
|
61
|
+
Given I have a form defined as:
|
62
|
+
"""Ruby
|
63
|
+
class MyForm
|
64
|
+
include PR::Form
|
65
|
+
|
66
|
+
def initialize argument
|
67
|
+
@my_argument = argument
|
68
|
+
end
|
69
|
+
attr_reader :my_argument
|
70
|
+
|
71
|
+
field :event_name, :string
|
72
|
+
field :start_date, :date
|
73
|
+
|
74
|
+
end
|
75
|
+
"""
|
76
|
+
And I have a hash:
|
77
|
+
"""Ruby
|
78
|
+
{
|
79
|
+
"event_name" => "Mien Event",
|
80
|
+
"start_date" => "31/03/2013"
|
81
|
+
}
|
82
|
+
"""
|
83
|
+
When I build my form using the macro:
|
84
|
+
"""Ruby
|
85
|
+
@form = MyForm.from_hash @hash, "An argument"
|
86
|
+
"""
|
87
|
+
Then my form should have a my_argument of "An argument"
|
88
|
+
|
data/features/support/dsl.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class World
|
4
|
-
require 'pr'
|
5
|
-
|
6
|
-
def run code
|
7
|
-
eval code
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'pr'
|
10
2
|
|
3
|
+
module DSL
|
11
4
|
|
12
5
|
def run_test code
|
13
6
|
world.run code
|
14
7
|
end
|
15
|
-
|
16
|
-
|
8
|
+
|
9
|
+
def setup_test code
|
10
|
+
world.load code
|
11
|
+
end
|
12
|
+
|
13
|
+
alias define_field setup_test
|
14
|
+
alias define_form setup_test
|
17
15
|
alias define_model run_test
|
18
16
|
|
19
17
|
def define_hash code
|
@@ -29,7 +27,19 @@ module DSL
|
|
29
27
|
end
|
30
28
|
|
31
29
|
def world
|
32
|
-
@world ||=
|
30
|
+
@world ||= world_klass.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def world_klass
|
34
|
+
Class.new do
|
35
|
+
def load code
|
36
|
+
self.class.class_eval code
|
37
|
+
end
|
38
|
+
|
39
|
+
def run code
|
40
|
+
self.instance_eval code
|
41
|
+
end
|
42
|
+
end
|
33
43
|
end
|
34
44
|
|
35
45
|
def set thing, attribute, value
|
data/lib/pr/form.rb
CHANGED
data/lib/pr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Rowe
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
|
30
30
|
/NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-04-
|
32
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|