spec/lib/stellar/operation_spec.rb in stellar-base-0.10.0 vs spec/lib/stellar/operation_spec.rb in stellar-base-0.11.0

- old
+ new

@@ -3,11 +3,28 @@ 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) + 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) + 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