-
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 #133 from TreinaDev/corrige-bugs-timezone
Corrige bugs de timezone
- Loading branch information
Showing
13 changed files
with
99 additions
and
86 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
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
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 |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
it 'must be authenticated to edit an superintendent' do | ||
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
get edit_condo_superintendent_path(condo, superintendent) | ||
|
||
|
@@ -17,8 +17,8 @@ | |
condo_manager = create :manager, is_super: false | ||
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
login_as condo_manager, scope: :manager | ||
|
||
|
@@ -30,8 +30,8 @@ | |
it 'must be authenticated as manager' do | ||
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
login_as resident, scope: :resident | ||
|
||
|
@@ -46,8 +46,8 @@ | |
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
resident2 = create(:resident, :with_residence, email: '[email protected]', condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
params = { superintendent: { tenant_id: resident2.id }, condo_id: condo.id } | ||
|
||
|
@@ -61,8 +61,8 @@ | |
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
resident2 = create(:resident, :with_residence, email: '[email protected]', condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
condo_manager = create :manager, is_super: false | ||
login_as condo_manager, scope: :manager | ||
|
@@ -79,8 +79,8 @@ | |
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, condo:) | ||
resident2 = create(:resident, :with_residence, email: '[email protected]', condo:) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Date.current, | ||
end_date: Date.current >> 2) | ||
|
||
login_as resident, scope: :resident | ||
|
||
|
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Manager edit superintendent' do | ||
it 'succesfully' do | ||
it 'successfully' do | ||
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, full_name: 'Dona Alvara', condo:) | ||
resident2 = create(:resident, :with_residence, full_name: 'Havana Silva', email: '[email protected]', condo:) | ||
superintendent = create(:superintendent, tenant: resident, condo:) | ||
travel_to '2024-07-21'.to_date | ||
superintendent = create(:superintendent, tenant: resident, condo:, start_date: '2024-07-21'.to_date, | ||
end_date: '2024-07-25'.to_date) | ||
|
||
manager = create :manager | ||
|
||
|
@@ -16,22 +18,24 @@ | |
visit condo_path condo | ||
click_on 'Dona Alvara' | ||
click_on 'Editar Síndico' | ||
fill_in 'Data de conclusão', with: Time.zone.today >> 30 | ||
fill_in 'Data de conclusão', with: '2024-07-25'.to_date | ||
select 'Havana Silva', from: 'Morador' | ||
click_on 'Enviar' | ||
|
||
superintendent.reload | ||
expect(page).to have_content 'Mandato de síndico atualizado com sucesso!' | ||
expect(current_path).to eq condo_superintendent_path(condo, Superintendent.last) | ||
expect(superintendent.end_date).to eq Time.zone.today >> 30 | ||
expect(superintendent.end_date).to eq '2024-07-25'.to_date | ||
expect(superintendent.tenant).to eq resident2 | ||
expect(resident.superintendent).to eq nil | ||
end | ||
|
||
it 'with missing params' do | ||
condo = create :condo, name: 'Condomínio X' | ||
resident = create(:resident, :with_residence, full_name: 'Dona Alvara', condo:) | ||
create(:superintendent, tenant: resident, condo:, start_date: Time.zone.today, end_date: Time.zone.today >> 2) | ||
travel_to '2024-07-21'.to_date | ||
create(:superintendent, tenant: resident, condo:, start_date: '2024-07-21'.to_date, | ||
end_date: '2024-07-25'.to_date) | ||
manager = create :manager | ||
|
||
resident.user_image.attach(io: Rails.root.join('spec/support/images/resident_photo.jpg').open, | ||
|
@@ -45,6 +49,6 @@ | |
click_on 'Enviar' | ||
|
||
expect(page).to have_content 'Não foi possível atualizar o mandato.' | ||
expect(Superintendent.last.end_date).to eq Time.zone.today >> 2 | ||
expect(Superintendent.last.end_date).to eq '2024-07-25'.to_date | ||
end | ||
end |
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 |
---|---|---|
|
@@ -7,8 +7,9 @@ | |
tower = create(:tower, condo:) | ||
unit11 = tower.floors.first.units.first | ||
resident = create :resident, full_name: 'Dona Alvara', residence: unit11, email: '[email protected]' | ||
create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
travel_to '2024-07-21'.to_date | ||
create(:superintendent, tenant: resident, condo:, start_date: '2024-07-21'.to_date, | ||
end_date: '2024-07-25'.to_date) | ||
manager = create :manager | ||
|
||
resident.user_image.attach(io: Rails.root.join('spec/support/images/resident_photo.jpg').open, | ||
|
@@ -26,8 +27,8 @@ | |
expect(page).to have_content 'Condomínio X' | ||
expect(page).to have_content 'Torre A' | ||
expect(page).to have_content 'Unidade: 11' | ||
expect(page).to have_content I18n.l Time.zone.today | ||
expect(page).to have_content I18n.l(Time.zone.today >> 2) | ||
expect(page).to have_content I18n.l('2024-07-21'.to_date) | ||
expect(page).to have_content I18n.l('2024-07-25'.to_date) | ||
end | ||
expect(page).to have_button 'Editar Síndico' | ||
end | ||
|
@@ -52,8 +53,9 @@ | |
tower = create(:tower, condo:) | ||
unit11 = tower.floors.first.units.first | ||
resident = create :resident, full_name: 'Dona Alvara', residence: unit11, email: '[email protected]' | ||
superintendent = create(:superintendent, condo:, tenant: resident, start_date: Time.zone.today, | ||
end_date: Time.zone.today >> 2) | ||
travel_to '2024-07-21'.to_date | ||
superintendent = create(:superintendent, tenant: resident, condo:, start_date: '2024-07-21'.to_date, | ||
end_date: '2024-07-25'.to_date) | ||
resident.user_image.attach(io: Rails.root.join('spec/support/images/resident_photo.jpg').open, | ||
filename: 'resident_photo.jpg') | ||
|
||
|
@@ -70,8 +72,8 @@ | |
expect(page).to have_content 'Condomínio X' | ||
expect(page).to have_content 'Torre A' | ||
expect(page).to have_content 'Unidade: 11' | ||
expect(page).to have_content I18n.l Time.zone.today | ||
expect(page).to have_content I18n.l(Time.zone.today >> 2) | ||
expect(page).to have_content I18n.l('2024-07-21'.to_date) | ||
expect(page).to have_content I18n.l('2024-07-25'.to_date) | ||
end | ||
|
||
expect(page).not_to have_button 'Editar Síndico' | ||
|
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
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
Oops, something went wrong.