diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5a4b60ef..6b4cf5ea 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.6', '2.7'] + ruby-version: ['2.7', '3.0', '3.1'] steps: - uses: actions/checkout@v2 diff --git a/lib/openactive/concerns/json_ld_serializable.rb b/lib/openactive/concerns/json_ld_serializable.rb index eb34bc2a..d17ab852 100644 --- a/lib/openactive/concerns/json_ld_serializable.rb +++ b/lib/openactive/concerns/json_ld_serializable.rb @@ -25,16 +25,18 @@ def property(field, as:) def values data = {} - self.class.properties.each do |key, field:| - data[key] = send(field) + self.class.properties.each do |key, field| + field_value = field[:field] + data[key] = send(field_value) end data end def to_h data = {} - self.class.properties.each do |_key, field:| - data[field] = send(field) + self.class.properties.each do |_key, field| + field_value = field[:field] + data[field_value] = send(field_value) end data end diff --git a/spec/data_structure/data_structure_spec.rb b/spec/data_structure/data_structure_spec.rb index f0308c37..f971bc7a 100644 --- a/spec/data_structure/data_structure_spec.rb +++ b/spec/data_structure/data_structure_spec.rb @@ -18,7 +18,9 @@ } ] - objs.each do |model:, data:| + objs.each do |obj| + model = obj[:model] + data = obj[:data] describe model do let(:inst) { model.deserialize(data) } diff --git a/spec/data_typing/data_typing_spec.rb b/spec/data_typing/data_typing_spec.rb index cf06992d..3dddbba4 100644 --- a/spec/data_typing/data_typing_spec.rb +++ b/spec/data_typing/data_typing_spec.rb @@ -15,7 +15,10 @@ } ] - objs.each do |model:, data:| + objs.each do |obj| + model = obj[:model] + data = obj[:data] + describe model do describe "#type" do it "reserializes to original value" do