spec/unit/mock_user_spec.rb in warden-github-rails-1.2.2 vs spec/unit/mock_user_spec.rb in warden-github-rails-1.2.3
- old
+ new
@@ -17,13 +17,17 @@
expect(user).to be_team_member(456)
expect(user).to be_organization_member('foobar')
end
end
- it 'can be marshaled' do
+ it 'can be serialized and deserialized with JSON' do
user = described_class.new
user.stub_membership(org: ['apple', 'facebook'], team: [12, 34])
- marshaled_user = Marshal.load(Marshal.dump(user))
+
+ json = ActiveSupport::JSON.encode(user.marshal_dump)
+ marshaled_user = described_class.new.tap do |u|
+ u.marshal_load(ActiveSupport::JSON.decode(json))
+ end
expect(marshaled_user.memberships).to eq(user.memberships)
end
end