spec/trackoid_spec.rb in trackoid-0.1.11 vs spec/trackoid_spec.rb in trackoid-0.1.12
- old
+ new
@@ -133,11 +133,11 @@
it "should have 4 visits for this test" do
@mock.visits.last_days(2).sum.should == 4
end
- it "should correctly handle the last 7 days" do
+ it "should correctly handle the 7 days" do
@mock.visits.last_days.should == [0, 0, 0, 0, 0, 2, 2]
end
it "string dates should work" do
@mock.visits.inc("2010-07-11")
@@ -159,65 +159,10 @@
it "should give the last value" do
@mock.visits.last_value.should == 2
end
end
- describe "Testing accessors with an empty model" do
- before do
- Test.delete_all
- Test.create(:name => "test")
- @object_id = Test.first.id
- @mock = Test.first
- end
-
- it "should return nil for .first_date" do
- @mock.visits.first_date.should be_nil
- end
-
- it "should return nil for .last_date" do
- @mock.visits.last_date.should be_nil
- end
-
- it "should return nil for .first_date" do
- @mock.visits.first_value.should be_nil
- end
-
- it "should return nil for .last_value" do
- @mock.visits.last_value.should be_nil
- end
-
- it "should return nil for .all_values" do
- @mock.visits.all_values.should be_nil
- end
- end
-
- describe "Testing new range accessors with an empty model" do
- before do
- Test.delete_all
- Test.create(:name => "test")
- @object_id = Test.first.id
- @mock = Test.first
- end
-
- it "should return the correct values for .all_values" do
- @mock.visits.set(1, "2010-07-11")
- @mock.visits.set(2, "2010-07-12")
- @mock.visits.set(3, "2010-07-13")
-
- @mock.visits.all_values.should == [1, 2, 3]
- end
-
- it "should return the correct values for .all_values (Take II)" do
- @mock.visits.set(5, "2010-07-01")
- @mock.visits.set(10, "2010-07-30")
-
- @mock.visits.all_values.should == [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
- @mock.visits.last_value.should == 10
- @mock.visits.first_value.should == 5
- end
- end
-
- context "testing accessor operations without reloading models" do
+ context "testing reader operations without reloading models" do
before(:all) do
Test.delete_all
Test.create(:name => "test")
@object_id = Test.first.id
end