membrane 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTNkMGJjYjViOWIzZDhiZDY5YjY0NDFmMzViODg3OTI2ZDNmNzU4Mw==
5
+ data.tar.gz: !binary |-
6
+ ODBhYWQ1NmU3NmFjMjk1YTAyMTdlZGU1ZWY2ZjRlMjgwMjAzNGRhYg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MjBmYzY4ZGUzZWQ5ZWFjZDgyOWUxOGJhMDkzYTdlNDQ2NmMzMmQ1Y2EyOTg3
10
+ OGFmNjBhNjUzNDI1ZTUxNzI3NmUyNGZhOTZmYWUwNzA5ZGFmMjRhNjUzM2Mz
11
+ NzBmMGVjZTQwMDI2ZWVhM2NjNDdjYTI0ZTk3MjYwZWRlYjQ2ZTI=
12
+ data.tar.gz: !binary |-
13
+ MzNlMTVmNDc5MmRiZjYyNGI5OGU0MWIxZGRhM2Y3NTczOGQ1N2U5YjNhNTEx
14
+ YjIwYjE5Nzc1ZTY2ZWE3MDZiMTE4ODljZmY3OGY4ZTBjY2M0Y2MxODNiNmZk
15
+ MDNlZjQ4YTM0MjgxZTVmMjdlNjVjYTE1ODAwNzIyZGYzNzdjMDg=
@@ -0,0 +1,38 @@
1
+ # Membrane changelog
2
+
3
+ ## 1.0.0
4
+
5
+ * Bump version to 1.0.0 to reflect changes from 0.0.x versions and to denote general stability of gem.
6
+
7
+
8
+ ## 0.0.5
9
+
10
+ * Refactor `fail!` methods in Schema types.
11
+
12
+
13
+ ## 0.0.4
14
+
15
+ * Rename `Membrane::Schema` to `Membrane::Schemas`. This is backwards-incompatible for any code relying directly on this module.
16
+ * Make schemas extensible.
17
+ * Update licenses.
18
+
19
+
20
+ ## 0.0.3
21
+
22
+ * Fix indentation.
23
+
24
+
25
+ ## 0.0.2
26
+
27
+ * Add deparse method for schema classes:
28
+ - The method: Membrane::Schema::Base#deparse returns string representation of a schema.
29
+ - Changed class: Membrane::Schema::Dictionary to sub-class Membrane::Schema::Base.
30
+ - Changed method: Membrane::SchemaParser#deparse to call `name` instead of `inspect` on a `Membrane::Schema::Class` object.
31
+ - Added/changed tests.
32
+ * Add tuple schema.
33
+ * Better pretty printing for schemas.
34
+
35
+
36
+ ## 0.0.1
37
+
38
+ * Initial commit.
@@ -72,7 +72,12 @@ class Membrane::Schemas::Record < Membrane::Schemas::Base
72
72
  end
73
73
 
74
74
  def fail!(errors)
75
- emsg = "{ " + errors.map { |k, e| "#{k} => #{e}" }.join(", ") + " }"
75
+ emsg =
76
+ if ENV['MEMBRANE_ERROR_USE_QUOTES']
77
+ "{ " + errors.map { |k, e| "'#{k}' => %q(#{e})" }.join(", ") + " }"
78
+ else
79
+ "{ " + errors.map { |k, e| "#{k} => #{e}" }.join(", ") + " }"
80
+ end
76
81
  raise Membrane::SchemaValidationError.new(emsg)
77
82
  end
78
83
  end
@@ -1,3 +1,3 @@
1
1
  module Membrane
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -86,6 +86,37 @@ describe Membrane::Schemas::Record do
86
86
  }.to_not raise_error
87
87
  end
88
88
  end
89
+
90
+ context "when ENV['MEMBRANE_ERROR_USE_QUOTES'] is set" do
91
+ it "returns an error message that can be parsed" do
92
+ ENV['MEMBRANE_ERROR_USE_QUOTES'] = 'true'
93
+ rec_schema = Membrane::SchemaParser.parse do
94
+ { "a_number" => Integer,
95
+ "tf" => bool,
96
+ "seventeen" => 17,
97
+ "nested_hash" => Membrane::SchemaParser.parse { { size: Float } }
98
+ }
99
+ end
100
+ error_hash = nil
101
+ begin
102
+ rec_schema.validate(
103
+ { 'tf' => 'who knows', 'seventeen' => 18,
104
+ 'nested_hash' => { size: 17, color: 'blue' } })
105
+ rescue Membrane::SchemaValidationError => e
106
+ error_hash = eval(e.to_s)
107
+ end
108
+ error_hash.should include(
109
+ 'tf' => 'Expected instance of true or false, given who knows')
110
+ error_hash.should include(
111
+ 'a_number' => 'Missing key')
112
+ error_hash.should include(
113
+ 'seventeen' => 'Expected 17, given 18')
114
+ error_hash.should include('nested_hash')
115
+ eval(error_hash['nested_hash']).should include(
116
+ 'size' => 'Expected instance of Float, given an instance of Fixnum')
117
+ ENV.delete('MEMBRANE_ERROR_USE_QUOTES')
118
+ end
119
+ end
89
120
  end
90
121
 
91
122
  describe "#parse" do
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: membrane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - mpage
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-28 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ci_reporter
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -69,6 +62,7 @@ extra_rdoc_files: []
69
62
  files:
70
63
  - .gitignore
71
64
  - .travis.yml
65
+ - CHANGELOG.md
72
66
  - Gemfile
73
67
  - LICENSE
74
68
  - NOTICE
@@ -107,27 +101,26 @@ files:
107
101
  - spec/spec_helper.rb
108
102
  homepage: http://www.cloudfoundry.org
109
103
  licenses: []
104
+ metadata: {}
110
105
  post_install_message:
111
106
  rdoc_options: []
112
107
  require_paths:
113
108
  - lib
114
109
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
110
  requirements:
117
111
  - - ! '>='
118
112
  - !ruby/object:Gem::Version
119
113
  version: '0'
120
114
  required_rubygems_version: !ruby/object:Gem::Requirement
121
- none: false
122
115
  requirements:
123
116
  - - ! '>='
124
117
  - !ruby/object:Gem::Version
125
118
  version: '0'
126
119
  requirements: []
127
120
  rubyforge_project:
128
- rubygems_version: 1.8.23
121
+ rubygems_version: 2.2.2
129
122
  signing_key:
130
- specification_version: 3
123
+ specification_version: 4
131
124
  summary: A DSL for validating data.
132
125
  test_files:
133
126
  - spec/complex_schema_spec.rb