Remove user feedback buttons
This commit is contained in:
parent
dc73500d61
commit
2a068fb9b0
12 changed files with 0 additions and 211 deletions
|
@ -185,60 +185,6 @@ describe StatsController, type: :controller do
|
|||
it { expect(subject).to eq(@expected_hash) }
|
||||
end
|
||||
|
||||
describe "#satisfaction_usagers" do
|
||||
before do
|
||||
# Test the stats on October 2018 – where the 1st, 8th, 15th, 22th and 29th are conveniently Mondays
|
||||
# Current week: 1 negative feedback
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 22, 12, 00)) { create(:feedback, :unhappy) }
|
||||
# Last week: 3 positive, 1 negative
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 21, 12, 00)) { create(:feedback, :unhappy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 19, 12, 00)) { create(:feedback, :happy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 17, 12, 00)) { create(:feedback, :happy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 15, 12, 00)) { create(:feedback, :happy) }
|
||||
# N-2 week: 2 positive, 2 negative
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 14, 12, 00)) { create(:feedback, :unhappy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 12, 12, 00)) { create(:feedback, :happy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 10, 12, 00)) { create(:feedback, :unhappy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 8, 12, 00)) { create(:feedback, :happy) }
|
||||
# N-3 week: 1 positive, 3 negative
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 1, 12, 00)) { create(:feedback, :unhappy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 3, 12, 00)) { create(:feedback, :happy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 5, 12, 00)) { create(:feedback, :unhappy) }
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 7, 12, 00)) { create(:feedback, :unhappy) }
|
||||
end
|
||||
|
||||
subject(:stats) do
|
||||
Timecop.freeze(Time.zone.local(2018, 10, 28, 12, 00)) {
|
||||
StatsController.new.send(:satisfaction_usagers)
|
||||
}
|
||||
end
|
||||
|
||||
it 'returns one set of values for each kind of feedback' do
|
||||
expect(stats.count).to eq 3
|
||||
expect(stats.map { |g| g[:name] }).to contain_exactly('Satisfaits', 'Neutres', 'Mécontents')
|
||||
end
|
||||
|
||||
it 'returns weekly ratios between a given feedback and all feedback' do
|
||||
happy_data = stats.find { |g| g[:name] == 'Satisfaits' }[:data]
|
||||
|
||||
expect(happy_data.values[-4]).to eq 0
|
||||
expect(happy_data.values[-3]).to eq 25.0
|
||||
expect(happy_data.values[-2]).to eq 50.0
|
||||
expect(happy_data.values[-1]).to eq 75.0
|
||||
|
||||
unhappy_data = stats.find { |g| g[:name] == 'Mécontents' }[:data]
|
||||
expect(unhappy_data.values[-4]).to eq 0
|
||||
expect(unhappy_data.values[-3]).to eq 75.0
|
||||
expect(unhappy_data.values[-2]).to eq 50.0
|
||||
expect(unhappy_data.values[-1]).to eq 25.0
|
||||
end
|
||||
|
||||
it 'excludes values still in the current week' do
|
||||
unhappy_data = stats.find { |g| g[:name] == 'Mécontents' }[:data]
|
||||
expect(unhappy_data.values).not_to include(100.0)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#avis_usage' do
|
||||
let!(:dossier) { create(:dossier) }
|
||||
let!(:avis_with_dossier) { create(:avis) }
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
FactoryBot.define do
|
||||
factory :feedback do
|
||||
rating { Feedback.ratings.fetch(:happy) }
|
||||
association :user
|
||||
|
||||
trait :happy do
|
||||
rating { Feedback.ratings.fetch(:happy) }
|
||||
end
|
||||
|
||||
trait :neutral do
|
||||
rating { Feedback.ratings.fetch(:neutral) }
|
||||
end
|
||||
|
||||
trait :unhappy do
|
||||
rating { Feedback.ratings.fetch(:unhappy) }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -69,17 +69,4 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
expect(rendered).to have_selector('ul.tabs li.active', count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
context "quand le user n'a aucun feedback" do
|
||||
it "affiche le formulaire de satisfaction" do
|
||||
expect(rendered).to have_selector('#user-satisfaction', text: 'Que pensez-vous de la facilité d\'utilisation de ce service ?')
|
||||
end
|
||||
end
|
||||
|
||||
context "quand le user a un feedback" do
|
||||
let(:user) { create(:user, feedbacks: [build(:feedback)]) }
|
||||
it "n'affiche pas le formulaire de satisfaction" do
|
||||
expect(rendered).to_not have_selector('#user-satisfaction')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue