fixes specs
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<%= back_link_to %>
|
<%= back_link_to %>
|
||||||
|
|
||||||
<div id="graph" class="small-12 column">
|
<div id="graph" class="small-12 column">
|
||||||
<h2><%= t "admin.stats.graph.#{name || event}" %>(<%= count %>)</h2>
|
<h2><%= t "admin.stats.graph.#{name || event}" %> (<%= count %>)</h2>
|
||||||
<%= chart_tag id: name, event: event %>
|
<%= chart_tag id: name, event: event %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1451,7 +1451,6 @@ en:
|
|||||||
verified_users_who_didnt_vote_proposals: Verified users who didn't votes proposals
|
verified_users_who_didnt_vote_proposals: Verified users who didn't votes proposals
|
||||||
visits: Visits
|
visits: Visits
|
||||||
votes: Total votes
|
votes: Total votes
|
||||||
spending_proposals_title: Spending Proposals
|
|
||||||
budgets_title: Participatory budgeting
|
budgets_title: Participatory budgeting
|
||||||
direct_messages: Direct messages
|
direct_messages: Direct messages
|
||||||
proposal_notifications: Proposal notifications
|
proposal_notifications: Proposal notifications
|
||||||
|
|||||||
@@ -1450,7 +1450,6 @@ es:
|
|||||||
verified_users_who_didnt_vote_proposals: Usuarios verificados que no han votado propuestas
|
verified_users_who_didnt_vote_proposals: Usuarios verificados que no han votado propuestas
|
||||||
visits: Visitas
|
visits: Visitas
|
||||||
votes: Votos
|
votes: Votos
|
||||||
spending_proposals_title: Propuestas de inversión
|
|
||||||
budgets_title: Presupuestos participativos
|
budgets_title: Presupuestos participativos
|
||||||
direct_messages: Mensajes directos
|
direct_messages: Mensajes directos
|
||||||
proposal_notifications: Notificaciones de propuestas
|
proposal_notifications: Notificaciones de propuestas
|
||||||
|
|||||||
@@ -31,23 +31,13 @@ describe Admin::Api::StatsController do
|
|||||||
|
|
||||||
it "returns single events formated for working with c3.js" do
|
it "returns single events formated for working with c3.js" do
|
||||||
sign_in user
|
sign_in user
|
||||||
get :show, params: { events: "foo" }
|
get :show, params: { event: "foo" }
|
||||||
|
|
||||||
expect(response).to be_ok
|
expect(response).to be_ok
|
||||||
|
|
||||||
data = JSON.parse(response.body)
|
data = JSON.parse(response.body)
|
||||||
expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [2, 1]
|
expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [2, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns combined comma separated events formated for working with c3.js" do
|
|
||||||
sign_in user
|
|
||||||
get :show, params: { events: "foo,bar" }
|
|
||||||
|
|
||||||
expect(response).to be_ok
|
|
||||||
|
|
||||||
data = JSON.parse(response.body)
|
|
||||||
expect(data).to eq "x" => ["2015-01-01", "2015-01-02", "2015-01-03"], "Foo" => [2, 1, 0], "Bar" => [1, 0, 2]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "visits present" do
|
context "visits present" do
|
||||||
@@ -69,29 +59,6 @@ describe Admin::Api::StatsController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "visits and events present" do
|
|
||||||
it "returns combined events and visits formated for working with c3.js" do
|
|
||||||
time_1 = Time.zone.local(2015, 01, 01)
|
|
||||||
time_2 = Time.zone.local(2015, 01, 02)
|
|
||||||
|
|
||||||
create :ahoy_event, name: "foo", time: time_1
|
|
||||||
create :ahoy_event, name: "foo", time: time_2
|
|
||||||
create :ahoy_event, name: "foo", time: time_2
|
|
||||||
|
|
||||||
create :visit, started_at: time_1
|
|
||||||
create :visit, started_at: time_1
|
|
||||||
create :visit, started_at: time_2
|
|
||||||
|
|
||||||
sign_in user
|
|
||||||
get :show, params: { events: "foo", visits: true }
|
|
||||||
|
|
||||||
expect(response).to be_ok
|
|
||||||
|
|
||||||
data = JSON.parse(response.body)
|
|
||||||
expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [1, 2], "Visits" => [2, 1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "budget investments present" do
|
context "budget investments present" do
|
||||||
it "returns budget investments formated for working with c3.js" do
|
it "returns budget investments formated for working with c3.js" do
|
||||||
time_1 = Time.zone.local(2017, 04, 01)
|
time_1 = Time.zone.local(2017, 04, 01)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ feature "Stats" do
|
|||||||
|
|
||||||
visit admin_stats_path
|
visit admin_stats_path
|
||||||
|
|
||||||
expect(page).to have_content "Level 2 User (1)"
|
expect(page).to have_content "Level two users 1"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,8 +15,13 @@ feature "Email campaigns" do
|
|||||||
5.times { visit root_url(track_id: @campaign2.track_id) }
|
5.times { visit root_url(track_id: @campaign2.track_id) }
|
||||||
|
|
||||||
visit admin_stats_path
|
visit admin_stats_path
|
||||||
|
click_link @campaign1.name
|
||||||
|
|
||||||
expect(page).to have_content "#{@campaign1.name} (3)"
|
expect(page).to have_content "#{@campaign1.name} (3)"
|
||||||
|
|
||||||
|
click_link "Go back"
|
||||||
|
click_link @campaign2.name
|
||||||
|
|
||||||
expect(page).to have_content "#{@campaign2.name} (5)"
|
expect(page).to have_content "#{@campaign2.name} (5)"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,8 +30,12 @@ feature "Email campaigns" do
|
|||||||
visit root_url(track_id: "999")
|
visit root_url(track_id: "999")
|
||||||
|
|
||||||
visit admin_stats_path
|
visit admin_stats_path
|
||||||
|
click_link @campaign1.name
|
||||||
|
|
||||||
expect(page).to have_content "#{@campaign1.name} (1)"
|
expect(page).to have_content "#{@campaign1.name} (1)"
|
||||||
|
|
||||||
|
click_link "Go back"
|
||||||
|
|
||||||
expect(page).not_to have_content @campaign2.name.to_s
|
expect(page).not_to have_content @campaign2.name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user