spec/lib/results_spec.rb in picky-4.19.4 vs spec/lib/results_spec.rb in picky-4.19.5
- old
+ new
@@ -2,23 +2,23 @@
describe Picky::Results do
describe "from" do
before(:each) do
- @results = stub :results
- described_class.stub! :new => @results
+ @results = double :results
+ described_class.stub :new => @results
- @results.stub! :prepare!
+ @results.stub :prepare!
end
it "should generate a result" do
described_class.from("some query", 20, 0, @allocations).should == @results
end
end
describe "ids" do
before(:each) do
- @allocations = stub :allocations
+ @allocations = double :allocations
@results = described_class.new :unimportant, :amount, :unimportant, @allocations
end
it "forwards" do
@allocations.should_receive(:ids).once.with :anything
@@ -38,12 +38,12 @@
end
end
describe 'to_s' do
before(:each) do
- time = stub :time, :strftime => '2011-08-16 10:07:33'
- Time.stub! :now => time
+ time = double :time, :strftime => '2011-08-16 10:07:33'
+ Time.stub :now => time
end
context 'without results' do
before(:each) do
@results = described_class.new "some_query"
end
@@ -51,16 +51,16 @@
@results.to_s.should == '.|2011-08-16 10:07:33|0.000000|some_query | 0| 0| 0|'
end
end
context 'with results' do
before(:each) do
- @allocations = stub :allocations,
+ @allocations = double :allocations,
:process! => nil,
:size => 12
@results = described_class.new "some_query", 20, 1234, @allocations
- @results.stub! :duration => 0.1234567890,
+ @results.stub :duration => 0.1234567890,
:total => 12345678
end
it 'should output a specific log' do
@results.to_s.should == '>|2011-08-16 10:07:33|0.123457|some_query |12345678|1234|12|'
end
@@ -70,18 +70,18 @@
describe 'to_json' do
before(:each) do
@results = described_class.new
end
it 'should do it correctly' do
- @results.stub! :to_hash => :serialized
+ @results.stub :to_hash => :serialized
@results.to_json.should == '"serialized"'
end
end
describe 'to_hash' do
before(:each) do
- @allocations = stub :allocations, :process! => nil, :to_result => :allocations, :total => :some_total
+ @allocations = double :allocations, :process! => nil, :to_result => :allocations, :total => :some_total
@results = described_class.new :unimportant, :some_results_amount, :some_offset, @allocations
@results.duration = :some_duration
end
it 'should do it correctly' do
\ No newline at end of file