Sha256: 392a48f36a6f4299b95580a4efb47f2fa0176c225e753e440f4a2aa42b77b5a8

Contents?: true

Size: 1001 Bytes

Versions: 3

Compression:

Stored size: 1001 Bytes

Contents

require 'spec_helper'

describe Stellar::Operation, ".payment" do


  it "correctly translates the provided amount to the native representation" do
    op = Stellar::Operation.payment(destination: Stellar::KeyPair.random, amount: [:native, 20])
    expect(op.body.value.amount).to eql(20_0000000)
    op = Stellar::Operation.payment(destination: Stellar::KeyPair.random, amount: [:native, "20"])
    expect(op.body.value.amount).to eql(20_0000000)
  end

end


describe Stellar::Operation, ".manage_data" do

  it "works" do
    op = Stellar::Operation.manage_data(name: "my name", value: "hello")
    expect(op.body.manage_data_op!.data_name).to eql("my name")
    expect(op.body.manage_data_op!.data_value).to eql("hello")
    expect{ op.to_xdr }.to_not raise_error

    op = Stellar::Operation.manage_data(name: "my name")
    expect(op.body.manage_data_op!.data_name).to eql("my name")
    expect(op.body.manage_data_op!.data_value).to be_nil
    expect{ op.to_xdr }.to_not raise_error
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stellar-base-0.13.0 spec/lib/stellar/operation_spec.rb
stellar-base-0.12.0 spec/lib/stellar/operation_spec.rb
stellar-base-0.11.0 spec/lib/stellar/operation_spec.rb