-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from TreinaDev/feat/add_answer_to_item_feedba…
…ck_details Usuario vê resposta do palestrante na tela de detalhes do feedback
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<br> | ||
<div id="answer"> | ||
<p><%=feedback_answer.comment%></p> | ||
<p><%=feedback_answer.name%></p> | ||
<p><%=feedback_answer.email%></p> | ||
<p><%=l(feedback_answer.created_at, format: :short)%></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,4 +100,54 @@ | |
expect(current_path).to eq root_path | ||
expect(page).to have_content 'Você não participa deste evento' | ||
end | ||
|
||
it 'e ve resposta do palestrante' do | ||
schedules = [ | ||
{ | ||
date: 5.day.ago, | ||
schedule_items: [ | ||
{ | ||
name: "Palestra", | ||
start_time: 5.day.ago.beginning_of_day + 9.hours, | ||
end_time: 5.day.ago.beginning_of_day + 10.hours, | ||
code: '1' | ||
} | ||
] | ||
} | ||
] | ||
batches = [ { | ||
batch_id: '1', | ||
name: 'Entrada - Meia', | ||
limit_tickets: 20, | ||
start_date: 5.days.ago.to_date, | ||
value: 20.00, | ||
end_date: 2.month.from_now.to_date, | ||
event_id: '1' | ||
} | ||
] | ||
event = build(:event, name: 'DevWeek', batches: batches, event_id: '1', start_date: 5.days.ago, end_date: 1.day.ago, schedules: schedules) | ||
schedule_item = event.schedules[0].schedule_items[0] | ||
ticket = create(:ticket, event_id: event.event_id, batch_id: '1') | ||
batches.map! { |batch| build(:batch, **batch) } | ||
allow(Batch).to receive(:request_batch_by_id).with("1", '1').and_return(batches[0]) | ||
allow(Event).to receive(:request_event_by_id).and_return(event) | ||
item_feedback = create(:item_feedback, title: 'Título Padrão', comment: 'Comentário Padrão', mark: 3, event_id: event.event_id, | ||
user: ticket.user, public: true, schedule_item_id: schedule_item.schedule_item_id) | ||
post "/api/v1/item_feedbacks/#{item_feedback.id}/feedback_answers", params: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
|
||
login_as ticket.user | ||
|
||
visit my_event_path(event.event_id, locale: :'pt-BR') | ||
click_on 'Título Padrão' | ||
|
||
within '#answer' do | ||
expect(page).to have_content 'Comentário Teste' | ||
expect(page).to have_content 'Nome do Participante Teste' | ||
expect(page).to have_content '[email protected]' | ||
end | ||
end | ||
end |