spec/fin/book_spec.rb in fin-0.1.0 vs spec/fin/book_spec.rb in fin-0.1.2
- old
+ new
@@ -1,22 +1,22 @@
require 'spec_helper'
require 'fin/shared_examples.rb'
-describe Fin::Book, 'as a replacement for OrderBook' do
- subject { Fin::Book.new :item_type => Fin::Order,
- :book_index => proc { |item| item.price },
- :book_condition => proc { |item| item.price > 0},
- :isin_id => 123456 }
+describe Fin::Book, 'as a replacement for QuoteBook' do
+ subject { Fin::Book.new :item_type => Fin::Quote,
+ :book_index => proc { |item| item.price },
+ :book_condition => proc { |item| item.price > 0 },
+ :isin_id => 123456 }
let(:item_index) { @item.price }
before(:each) do
- @item = Fin::Order.new :id => 0, :price => 20, :isin => 123456
- @item1 = Fin::Order.new :id => 1, :price => 15, :isin => 123456
- @item2 = Fin::Order.new :id => 2, :price => 10, :isin => 123456
- @zero_price_item = Fin::Order.new :id => 3, :price => 0, :isin => 123456
- @wrong_isin_item = Fin::Order.new :id => 4, :price => 50, :isin => 456123
+ @item = Fin::Quote.new :repl_id => 0, :price => 20, :isin_id => 123456
+ @item1 = Fin::Quote.new :repl_id => 1, :price => 15, :isin_id => 123456
+ @item2 = Fin::Quote.new :repl_id => 2, :price => 10, :isin_id => 123456
+ @zero_price_item = Fin::Quote.new :repl_id => 3, :price => 0, :isin_id => 123456
+ @wrong_isin_item = Fin::Quote.new :repl_id => 4, :price => 50, :isin_id => 456123
end
it_behaves_like 'changed_list'
its (:isin_id) {should == 123456}
@@ -32,11 +32,11 @@
expect { subject.isin_id = 1313 }.to raise_error NoMethodError
expect { subject.isin = 1313 }.to raise_error NoMethodError
end
describe '#check' do
- it 'fails if item is not an Order' do
+ it 'fails if item is not an Quote' do
subject.check(1).should == false
end
it 'fails if item has wrong isin_id' do
subject.check(@wrong_isin_item).should == false
@@ -121,18 +121,18 @@
end
end
describe Fin::Book, 'as a replacement for DealBook' do
subject { Fin::Book.new :item_type => Fin::Deal,
- :book_index => proc { |item| item.deal_id },
- :isin_id => 123456 }
+ :book_index => proc { |item| item.deal_id },
+ :isin_id => 123456 }
let(:item_index) { @item.deal_id }
before(:each) do
- @item = Fin::Deal.new :id => 0, :deal_id => 20, :isin => 123456
- @item1 = Fin::Deal.new :id => 1, :deal_id => 30, :isin => 123456
- @item2 = Fin::Deal.new :id => 2, :deal_id => 40, :isin => 123456
- @wrong_isin_item = Fin::Deal.new :id => 3, :deal_id => 50, :isin => 456123
+ @item = Fin::Deal.new :repl_id => 0, :deal_id => 20, :isin_id => 123456
+ @item1 = Fin::Deal.new :repl_id => 1, :deal_id => 30, :isin_id => 123456
+ @item2 = Fin::Deal.new :repl_id => 2, :deal_id => 40, :isin_id => 123456
+ @wrong_isin_item = Fin::Deal.new :repl_id => 3, :deal_id => 50, :isin_id => 456123
end
it_behaves_like 'changed_list'
its (:isin_id) {should == 123456}