Skip to content

Commit 08716b5

Browse files
committed
Stop using OpenStruct
1 parent 4c2c286 commit 08716b5

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

spec/serializable/attributes_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'spec_helper'
2-
require 'ostruct'
32

43
describe RestPack::Serializer::Attributes do
54
class CustomSerializer
@@ -8,7 +7,7 @@ class CustomSerializer
87
attributes :d, :e, :f?
98
optional :sometimes, :maybe
109
attribute :old_attribute, :key => :new_key
11-
transform [:gonzaga], lambda { |name, model| model.send(name).downcase }
10+
transform [:gonzaga], lambda { |name, model| model[name].downcase }
1211
end
1312

1413
subject(:attributes) { CustomSerializer.serializable_attributes }
@@ -34,7 +33,7 @@ class CustomSerializer
3433
end
3534

3635
describe "optional attributes" do
37-
let(:model) { OpenStruct.new(a: 'A', sometimes: 'SOMETIMES', gonzaga: 'GONZAGA') }
36+
let(:model) { { a: 'A', sometimes: 'SOMETIMES', gonzaga: 'GONZAGA' } }
3837
let(:context) { {} }
3938
subject(:as_json) { CustomSerializer.as_json(model, context) }
4039

@@ -54,7 +53,7 @@ class CustomSerializer
5453
end
5554

5655
describe '#transform_attributes' do
57-
let(:model) { OpenStruct.new(gonzaga: 'IS A SCHOOL') }
56+
let(:model) { { gonzaga: 'IS A SCHOOL' } }
5857

5958
subject(:as_json) { CustomSerializer.as_json(model) }
6059

0 commit comments

Comments
 (0)