changes unfinished

This commit is contained in:
2013-01-17 10:28:05 +01:00
parent 730768cb59
commit db1a6ac96b
13 changed files with 88 additions and 13 deletions
+34
View File
@@ -0,0 +1,34 @@
# encoding: UTF-8
require 'spec_helper'
describe Table do
describe 'for_supplier' do
let(:supplier){ create(:supplier) }
let(:options){ Hash.new }
subject{ Table.for_supplier(supplier, options) }
it "should return an empty array by default" do
subject.should be_empty
end
describe 'with multiple tables' do
before do
@table1 = create :table, supplier: supplier, number: 2
@table2 = create :table, supplier: supplier, number: 4
@table3 = create :table, supplier: supplier, number: 6
@table4 = create :table, number: 4
end
it "returns all by default" do
subject.should == [@table1, @table2, @table3]
end
it "should paginate the result" do
options[:per_page] = 2
subject.size.should == 2
subject.total_count.should == 3
end
end
end
end