Skip to content

Instantly share code, notes, and snippets.

@lpradovera
Created July 11, 2012 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lpradovera/09199e330197a227455c to your computer and use it in GitHub Desktop.
Save lpradovera/09199e330197a227455c to your computer and use it in GitHub Desktop.
#code
post '/archive_message/:id' do
msg = Recording.first(id: params[:id])
if msg
msg.archived = true
msg.save_changes
json({ status: "ok" })
else
error(400, 'Invalid Message Id')
end
end
#test
it "should archive the message and respond with a status ok message" do
mailbox = create(:mailbox)
recording = create(:recording, :mailbox_id => mailbox.id, :archived => false)
post "/archive_message/#{recording.id}"
recording.archived.should == true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment