distributed memoizer added to ensure absolute duplicate posts don't get through

in case of an absolute dupe just return the memoized post

This works around issues with wordpress being crazy
This commit is contained in:
Sam 2013-07-29 12:25:19 +10:00
parent 1e107fd68a
commit 4a20d09523
4 changed files with 162 additions and 11 deletions
spec/controllers

View file

@ -282,6 +282,18 @@ describe PostsController do
::JSON.parse(response.body).should be_present
end
it 'protects against dupes' do
# TODO we really should be using a mock redis here
xhr :post, :create, {raw: 'this is a test post 123', title: 'this is a test title 123', wpid: 1}
response.should be_success
original = response.body
xhr :post, :create, {raw: 'this is a test post 123', title: 'this is a test title 123', wpid: 2}
response.should be_success
response.body.should == original
end
context "errors" do
let(:post_with_errors) { Fabricate.build(:post, user: user)}