Sha256: ed25cfda05902ee936411e5cf3304c33c512c99b47dca1a3b887c96f239700a3

Contents?: true

Size: 716 Bytes

Versions: 11

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

require "rails_spec_helper"

RSpec.describe Money::Rails::JobArgumentSerializer do
  it "roundtrip a Money argument returns the same object" do
    job = MoneyTestJob.new(value: Money.new(10.21, "BRL"))

    serialized_job = job.serialize
    serialized_value = serialized_job["arguments"][0]["value"]
    expect(serialized_value["_aj_serialized"]).to eq("Money::Rails::JobArgumentSerializer")
    expect(serialized_value["value"]).to eq("10.21")
    expect(serialized_value["currency"]).to eq("BRL")

    job2 = MoneyTestJob.deserialize(serialized_job)
    job2.send(:deserialize_arguments_if_needed)

    expect(job2.arguments.first[:value]).to eq(Money.new(10.21, "BRL"))
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-money-3.0.0 spec/rails/job_argument_serializer_spec.rb
shopify-money-2.2.2 spec/rails/job_argument_serializer_spec.rb
shopify-money-2.2.1 spec/rails/job_argument_serializer_spec.rb
shopify-money-2.2.0 spec/rails/job_argument_serializer_spec.rb
shopify-money-2.0.0 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.3.0 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.2.1 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.2.0 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.1.2 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.1.1 spec/rails/job_argument_serializer_spec.rb
shopify-money-1.1.0 spec/rails/job_argument_serializer_spec.rb