Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Booleans should be atoms, not strings #33

Merged
merged 1 commit into from Dec 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions spec/requests/proposals_spec.exs
Expand Up @@ -40,8 +40,8 @@ defmodule ParticipateApi.ProposalsSpec do
"title" => proposal.title,
"body"=> proposal.body,
"support-count" => 0,
"supported-by-me" => "false",
"authored-by-me" => "false"
"supported-by-me" => false,
"authored-by-me" => false
},
"relationships" => %{
"author" => %{
Expand Down Expand Up @@ -114,8 +114,8 @@ defmodule ParticipateApi.ProposalsSpec do
"title" => proposal.title,
"body"=> proposal.body,
"support-count" => 0,
"supported-by-me" => "false",
"authored-by-me" => "true"
"supported-by-me" => false,
"authored-by-me" => true
},
"relationships" => %{
"author" => %{
Expand Down Expand Up @@ -150,7 +150,7 @@ defmodule ParticipateApi.ProposalsSpec do
it "returns the proposal" do
response_body = subject.resp_body
payload = Poison.Parser.parse!(response_body)
expect(payload["data"]["attributes"]["authored-by-me"]).to eql("false")
expect(payload["data"]["attributes"]["authored-by-me"]).to eql(false)
end
end

Expand Down Expand Up @@ -227,8 +227,8 @@ defmodule ParticipateApi.ProposalsSpec do
"title" => "Title",
"body"=> "Body",
"support-count" => 0,
"supported-by-me" => "false",
"authored-by-me" => "true"
"supported-by-me" => false,
"authored-by-me" => true
},
"relationships" => %{
"author" => %{
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/supports_spec.exs
Expand Up @@ -87,7 +87,7 @@ defmodule ParticipateApi.SupportsSpec do
"id" => "#{proposal.id}",
"attributes" => %{
"support-count" => 1,
"supported-by-me" => "true",
"supported-by-me" => true,
}
}
],
Expand Down
8 changes: 4 additions & 4 deletions web/views/proposal_view.ex
Expand Up @@ -20,9 +20,9 @@ defmodule ParticipateApi.ProposalView do

def authored_by_me(proposal, conn) do
if proposal.author.id == conn.assigns[:account].participant_id do
"true"
true
else
"false"
false
end
end

Expand All @@ -33,9 +33,9 @@ defmodule ParticipateApi.ProposalView do
me_id = conn.assigns[:account].participant_id

if me_id in support_author_ids do
"true"
true
else
"false"
false
end
end

Expand Down
4 changes: 2 additions & 2 deletions web/views/proposal_with_support_count_view.ex
Expand Up @@ -23,9 +23,9 @@ defmodule ParticipateApi.ProposalWithSupportCountView do
me_id = conn.assigns[:account].participant_id

if me_id in support_author_ids do
"true"
true
else
"false"
false
end
end

Expand Down