Miscellaneous fixes from PR#3000

FIX: Don't require login to view post raw
FIX: Don't submit read-guidelines for anonymous users (causes
unnecessary 403 errors from ensure_logged_in)
FIX: Don't pass nil to an array serializer
This commit is contained in:
riking
2015-01-05 08:02:32 -08:00
parent a6ce188f35
commit 85a7b925c7
3 changed files with 32 additions and 5 deletions

View File

@ -799,4 +799,26 @@ describe PostsController do
end
describe "view raw" do
describe "by ID" do
it "can be viewed by anonymous" do
post = Fabricate(:post, raw: "123456789")
xhr :get, :markdown_id, id: post.id
response.should be_success
response.body.should == "123456789"
end
end
describe "by post number" do
it "can be viewed by anonymous" do
topic = Fabricate(:topic)
post = Fabricate(:post, topic: topic, post_number: 1, raw: "123456789")
post.save
xhr :get, :markdown_num, topic_id: topic.id, post_number: 1
response.should be_success
response.body.should == "123456789"
end
end
end
end