Sha256: 6663102d407c8743dd972104f590716cf87fdda2b8b93ffd3986d196d218592c
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require_relative '../../../spec_helper' describe Bitstampede::Entities::Order do subject{ described_class.new(order_hash) } context "a successful order" do let(:order_hash){ { "id" => "1", "datetime" => 1234567, "type" => 0, "price" => "1.23", "amount" => "10" } } it "has an id" do expect(subject.id).to eq(1) end describe "type" do it "maps 0 to :buy" do expect(subject.type).to eq(:buy) end it "maps 1 to :sell" do order = described_class.new(order_hash.merge({"type" => 1})) expect(order.type).to eq(:sell) end it "raises InvalidTypeError for other values" do expect { described_class.new(order_hash.merge({"type" => 2})) }.to raise_error(Bitstampede::Entities::Order::InvalidTypeError) end end end context "an unsuccessful order" do let(:order_hash){ # Don't get mad at me, not my fault bitstamp errors look like this { "error" => { "__all__" => ["Minimum order size is $1"] } } } it "raises an appropriate error" do expect{ subject }.to raise_error(Bitstampede::StandardError, "Minimum order size is $1") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bitstampede-0.1.7 | spec/unit/bitstampede/entities/order_spec.rb |
bitstampede-0.1.6 | spec/unit/bitstampede/entities/order_spec.rb |