Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Adds test for max_out_sync_retries.
Browse files Browse the repository at this point in the history
  • Loading branch information
joegatt committed Mar 5, 2013
1 parent 8139d18 commit 1aaee65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion spec/models/cloud_note_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
its(:cloud_service) { should == cloud_service }

it { should validate_presence_of(:cloud_note_identifier) }
it { should validate_presence_of(:note) }
# it { should validate_presence_of(:note) }
it { should validate_presence_of(:cloud_service) }

it { should validate_uniqueness_of(:cloud_note_identifier).scoped_to(:cloud_service_id) }
Expand All @@ -35,6 +35,14 @@
CloudNote.needs_syncdown.last.should == @cloud_note
end

describe "needs_syncdown scope should increment sync_retries when requested to" do
before {
@cloud_note = FactoryGirl.create(:cloud_note, :sync_retries => 0)
@cloud_note.increment_sync_retries
}
its(:sync_retries) { should == 1 }
end

describe "needs_syncdown scope should not contain dirty notes that have been retried too often" do
before {
@cloud_note = FactoryGirl.create(:cloud_note, :dirty => true, :sync_retries => Settings.notes.sync_retries + 1)
Expand All @@ -45,6 +53,7 @@
describe "a cloud_note is disincluded from needs_syncdown when max_out method is applied to it" do
before {
@cloud_note = FactoryGirl.create(:cloud_note, :dirty => true)
@cloud_note.increment_sync_retries
@cloud_note.max_out_sync_retries
}
CloudNote.needs_syncdown.last.should == nil
Expand Down

0 comments on commit 1aaee65

Please sign in to comment.