spec/bitcoin/builder_spec.rb in bitcoin-ruby-0.0.7 vs spec/bitcoin/builder_spec.rb in bitcoin-ruby-0.0.8
- old
+ new
@@ -101,9 +101,20 @@
t.input {|i| i.prev_out prev_tx.hash, 0, prev_tx.out[0].pk_script }
end
tx1.in[0].should == tx2.in[0]
end
+ it "should provide tx#output shortcut" do
+ tx1 = build_tx {|t| t.output(123, @keys[1].addr) }
+ tx1.should == build_tx do |t|
+ t.output {|o| o.value 123; o.to @keys[1].addr }
+ end
+
+ tx2 = build_tx {|t| t.output(123, @keys[1].pub, :pubkey) }
+ tx2.should == build_tx do |t|
+ t.output {|o| o.value 123; o.to @keys[1].pub, :pubkey }
+ end
+ end
it "should provide txout#to shortcut" do
tx1 = build_tx do |t|
t.output {|o| o.value 123; o.to @keys[1].addr }
end