Adding post details in preparation for the API importer code.

This commit is contained in:
James Edward Gray II
2013-10-15 09:21:30 -05:00
parent 20039860eb
commit 1aa9fc982d
6 changed files with 65 additions and 0 deletions

View File

@ -26,6 +26,8 @@ describe Post do
it { should have_many :post_uploads }
it { should have_many :uploads }
it { should have_many :post_details }
it { should rate_limit }
let(:topic) { Fabricate(:topic) }
@ -760,4 +762,20 @@ describe Post do
end
end
describe "details" do
it "adds details" do
post = Fabricate.build(:post)
post.add_detail("key", "value")
post.post_details.size.should == 1
post.post_details.first.key.should == "key"
post.post_details.first.value.should == "value"
end
it "can find a post by a detail" do
detail = Fabricate(:post_detail)
post = detail.post
Post.find_by_detail(detail.key, detail.value).id.should == post.id
end
end
end