schemata-router 0.0.1.beta8 → 0.0.1.beta9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ module Schemata
14
14
  @contents = {}
15
15
 
16
16
  data.each do |key, field_value|
17
+ key = Schemata::HashCopyHelpers.stringify(key)
17
18
  field_schema = @schema.schemas[key]
18
19
  next unless field_schema
19
20
 
@@ -1,5 +1,5 @@
1
1
  module Schemata
2
2
  module Router
3
- VERSION = "0.0.1.beta8"
3
+ VERSION = "0.0.1.beta9"
4
4
  end
5
5
  end
@@ -53,6 +53,10 @@ def num_mandatory_fields(msg_obj)
53
53
  return diff.size
54
54
  end
55
55
 
56
+ def all_classes
57
+ all_classes = Set.new([Integer, String, Float, TrueClass, FalseClass, NilClass, Hash, Array])
58
+ end
59
+
56
60
  def get_allowed_classes(schema)
57
61
  case schema
58
62
  when Membrane::Schema::Bool
@@ -65,11 +69,12 @@ def get_allowed_classes(schema)
65
69
  return Set.new([Hash])
66
70
  when Membrane::Schema::List
67
71
  return Set.new([Array])
72
+ when Membrane::Schema::Value
73
+ return Set.new([schema.value.class])
68
74
  end
69
75
  end
70
76
 
71
77
  def get_unallowed_classes(schema)
72
- all_classes = Set.new([Integer, String, Float, TrueClass, FalseClass, NilClass, Hash, Array])
73
78
  allowed_classes = get_allowed_classes(schema)
74
79
  all_classes - allowed_classes
75
80
  end
@@ -44,6 +44,18 @@ shared_examples "a message" do
44
44
  msg_obj = message.new({first_key => bad_value})
45
45
  }.to raise_error(Schemata::UpdateAttributeError)
46
46
  end
47
+
48
+ it "should stringify keys when they are symbols" do
49
+ mock_hash = component.send(mock_method, 1).contents
50
+ first_key = mock_hash.keys[0]
51
+ first_value = mock_hash[first_key]
52
+
53
+ input_hash = {
54
+ first_key.to_sym => first_value
55
+ }
56
+ msg_obj = message.new(input_hash)
57
+ msg_obj.send(first_key).should_not be_nil
58
+ end
47
59
  end
48
60
 
49
61
  describe "#encode" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemata-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta8
4
+ version: 0.0.1.beta9
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: