Wizard: Server Side Validation + Finished Step

This commit is contained in:
Robin Ward
2016-08-31 13:35:49 -04:00
parent be1d74d207
commit 9f12b571ef
35 changed files with 260 additions and 62 deletions

View File

@ -19,15 +19,15 @@ describe StepsController do
log_in(:admin)
end
it "raises an error with an invalid id" do
xhr :put, :update, id: 'made-up-id', fields: { forum_title: "updated title" }
expect(response).to_not be_success
it "updates properly if you are staff" do
xhr :put, :update, id: 'contact', fields: { contact_email: "eviltrout@example.com" }
expect(response).to be_success
expect(SiteSetting.contact_email).to eq("eviltrout@example.com")
end
it "updates properly if you are staff" do
xhr :put, :update, id: 'forum-title', fields: { title: "updated title" }
expect(response).to be_success
expect(SiteSetting.title).to eq("updated title")
it "returns errors if the field has them" do
xhr :put, :update, id: 'contact', fields: { contact_email: "not-an-email" }
expect(response).to_not be_success
end
end