Add debates translation interface

Also fix broken spec after removing translatable attributes from
strong_parameters definition. Now we need to send these attributes
as nested translations attributes.

Use activerecord.yml title attribute label so form helper could load it
from default location.
This commit is contained in:
Senén Rodero Rodríguez
2018-12-23 18:31:36 +01:00
committed by voodoorai2000
parent f77e7df33e
commit 51cda51155
6 changed files with 43 additions and 21 deletions

View File

@@ -12,16 +12,19 @@ describe DebatesController do
end
it "creates an ahoy event" do
debate_attributes = {
terms_of_service: "1",
translations_attributes: {
"0" => {
title: "A sample debate",
description: "this is a sample debate",
locale: "en"
}
}
}
sign_in create(:user)
post :create, params: {
debate: {
title: "A sample debate",
description: "this is a sample debate",
terms_of_service: 1
}
}
post :create, debate: debate_attributes
expect(Ahoy::Event.where(name: :debate_created).count).to eq 1
expect(Ahoy::Event.last.properties["debate_id"]).to eq Debate.last.id
end