Commit 269c53ab authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei

Code formatting on controllers tests

Signed-off-by: Bruno Freitas Tissei's avatarBruno Freitas Tissei <bft15@inf.ufpr.br>
parent 64312cc0
Pipeline #7285 failed with stage
in 9 seconds
......@@ -2,20 +2,23 @@ require 'test_helper'
class Api::V1::Accounts::RegistrationsControllerTest < ActionDispatch::IntegrationTest
describe Api::V1::Accounts::RegistrationsController do
describe "Successful registration" do
before do
@number_of_accounts = Account.count
@number_of_citizens = Citizen.count
@santa_catarina = State.new(abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina")
@santa_catarina = State.new(
abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina"
)
@santa_catarina.save!
@joinville = City.new(ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id)
@joinville = City.new(
ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id
)
@joinville.save!
......
......@@ -4,31 +4,34 @@ class Api::V1::Accounts::SessionsControllerTest < ActionDispatch::IntegrationTes
describe Api::V1::Accounts::SessionsController do
describe "Token access" do
before do
@santa_catarina = State.new(abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina")
@santa_catarina.save!
@santa_catarina = State.new(
abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina"
)
@santa_catarina.save!
@joinville = City.new(ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id)
@joinville.save!
@joinville = City.new(
ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id
)
@joinville.save!
post '/v1/auth', params: {
birth_date: "Apr 18 1997",
cep: "81530-110",
cpf: "10845922904",
email: "test@example.com",
name: "Test Example",
phone1: "121212-1212",
rg: "1234567",
city_id: @joinville.id,
password: "123mudar",
password_confirmation: "123mudar"
}
post '/v1/auth', params: {
birth_date: "Apr 18 1997",
cep: "81530-110",
cpf: "10845922904",
email: "test@example.com",
name: "Test Example",
phone1: "121212-1212",
rg: "1234567",
city_id: @joinville.id,
password: "123mudar",
password_confirmation: "123mudar"
}
@citizen = Citizen.where(cpf: "10845922904").first
@citizen = Citizen.where(cpf: "10845922904").first
end
describe "Successful sign in" do
......
......@@ -3,26 +3,31 @@ require "test_helper"
class Api::V1::CepControllerTest < ActionDispatch::IntegrationTest
describe "City creation" do
before do
@parana = State.new(abbreviation: "PR",
ibge_code: "41",
name: "Paraná")
@parana = State.new(
abbreviation: "PR",
ibge_code: "41",
name: "Paraná"
)
@parana.save!
@curitiba = City.new(ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id)
@curitiba = City.new(
ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id
)
@curitiba.save!
@curitiba_city_hall = CityHall.new(name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text");
@curitiba_city_hall = CityHall.new(
name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text"
);
@curitiba_city_hall.save!
end
......
......@@ -3,30 +3,37 @@ require 'test_helper'
class Api::V1::CitizensControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@parana = State.new(abbreviation: "PR",
ibge_code: "41",
name: "Paraná")
@parana = State.new(
abbreviation: "PR",
ibge_code: "41",
name: "Paraná"
)
@parana.save!
@curitiba = City.new(ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id)
@curitiba = City.new(
ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id
)
@curitiba.save!
@citizen = Citizen.new(cpf: "10845922904",
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @curitiba.id)
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@citizen = Citizen.new(
cpf: "10845922904",
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @curitiba.id
)
@citizen.active = true
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
......
......@@ -3,54 +3,69 @@ require 'test_helper'
class CityHallsControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@parana = State.new(abbreviation: "PR",
ibge_code: "41",
name: "Paraná")
@santa_catarina = State.new(abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina")
@parana = State.new(
abbreviation: "PR",
ibge_code: "41",
name: "Paraná"
)
@parana.save!
@santa_catarina = State.new(
abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina"
)
@santa_catarina.save!
@curitiba = City.new(ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id)
@joinville = City.new(ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id)
@curitiba = City.new(
ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id
)
@curitiba.save!
@joinville.save!
@joinville_city_hall = CityHall.new(name: "Prefeitura de Joinville",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @joinville.id,
phone1: "1414141414",
active: true,
block_text: "Test block text");
@citizen = Citizen.new(cpf: "10845922904",
active: true,
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @joinville.id)
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@joinville = City.new(
ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id
)
@joinville.save!
@joinville_city_hall = CityHall.new(
name: "Prefeitura de Joinville",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @joinville.id,
phone1: "1414141414",
active: true,
block_text: "Test block text"
)
@joinville_city_hall.save!
@citizen = Citizen.new(
cpf: "10845922904",
active: true,
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @joinville.id
)
@citizen.active = true
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
@joinville_city_hall.save!
@auth_headers = @account.create_new_auth_token
......
......@@ -3,32 +3,37 @@ require 'test_helper'
class Api::V1::DependantsControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@santa_catarina = State.new(abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina")
@santa_catarina = State.new(
abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina"
)
@santa_catarina.save!
@joinville = City.new(ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id)
@joinville = City.new(
ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id
)
@joinville.save!
@citizen= Citizen.new(active: true,
cpf: "10845922904",
birth_date: "18/04/1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
city_id: @joinville.id,
rg: "1234567")
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@citizen= Citizen.new(
active: true,
cpf: "10845922904",
birth_date: "18/04/1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
city_id: @joinville.id,
rg: "1234567"
)
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
......@@ -124,7 +129,8 @@ class Api::V1::DependantsControllerTest < ActionDispatch::IntegrationTest
@dependant = Dependant.where(citizen_id: @citizen.id).first
put '/v1/dependants/' + @dependant.id.to_s,
params: {dependant: { active: false }}, headers: @auth_headers
params: {dependant: { active: false }},
headers: @auth_headers
@resp_token = response.headers['access-token']
@resp_client_id = response.headers['client']
@resp_expiry = response.headers['expiry']
......
......@@ -3,43 +3,52 @@ require 'test_helper'
class OccupationsControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@parana = State.new(abbreviation: "PR",
ibge_code: "41",
name: "Paraná")
@parana = State.new(
abbreviation: "PR",
ibge_code: "41",
name: "Paraná"
)
@parana.save!
@curitiba = City.new(ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id)
@curitiba = City.new(
ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id
)
@curitiba.save!
@citizen = Citizen.new(cpf: "10845922904",
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
city_id: @curitiba.id,
rg: "1234567")
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@curitiba_city_hall = CityHall.new(name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text");
@citizen = Citizen.new(
cpf: "10845922904",
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
city_id: @curitiba.id,
rg: "1234567"
)
@citizen.active = true
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
@curitiba_city_hall = CityHall.new(
name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text"
)
@curitiba_city_hall.save!
@auth_headers = @account.create_new_auth_token
......
......@@ -3,53 +3,62 @@ require 'test_helper'
class Api::V1::ProfessionalsControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@parana = State.new(abbreviation: "PR",
ibge_code: "41",
name: "Paraná")
@parana = State.new(
abbreviation: "PR",
ibge_code: "41",
name: "Paraná"
)
@parana.save!
@curitiba = City.new(ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id)
@curitiba = City.new(
ibge_code: "4106902",
name: "Curitiba",
state_id: @parana.id
)
@curitiba.save!
@citizen= Citizen.new(active: true,
cpf: "10845922904",
birth_date: "18/04/1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @curitiba.id)
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@citizen= Citizen.new(
active: true,
cpf: "10845922904",
birth_date: "18/04/1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @curitiba.id
)
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
@curitiba_city_hall = CityHall.new(name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text");
@curitiba_city_hall = CityHall.new(
name: "Prefeitura de Curitiba",
cep: "1234567",
neighborhood: "Test neighborhood",
address_street: "Test street",
address_number: "123",
city_id: @curitiba.id,
phone1: "1414141414",
active: true,
block_text: "Test block text"
)
@curitiba_city_hall.save!
@occupation = Occupation.new(description: "Teste",
name: "Tester",
active: true,
city_hall_id: @curitiba_city_hall.id)
@occupation = Occupation.new(
description: "Teste",
name: "Tester",
active: true,
city_hall_id: @curitiba_city_hall.id
)
@occupation.save!
@account.save!
@citizen.account_id = @account.id
@citizen.save!
@auth_headers = @account.create_new_auth_token
@token = @auth_headers['access-token']
......
require 'test_helper'
class Api::V1::SchedulesControllerTest < ActionDispatch::IntegrationTest
describe "Token access" do
before do
@santa_catarina = State.new(abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina")
@santa_catarina = State.new(
abbreviation: "SC",
ibge_code: "42",
name: "Santa Catarina"
)
@santa_catarina.save!
@joinville = City.new(ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id)
@joinville = City.new(
ibge_code: "4209102",
name: "Joinville",
state_id: @santa_catarina.id
)
@joinville.save!
@citizen = Citizen.new(cpf: "10845922904",
active: true,
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @joinville.id)
@account = Account.new(uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar")
@city_hall = CityHall.new(name: "Prefeitura de Joinville",
cep: "81530110",
neighborhood: "Aasdsd",
address_street: "asdasd",
address_number: "100",
city_id: @joinville.id,
phone1: "12121212",
active: true,
block_text: "hello")
@occupation = Occupation.new(description: "Cargo",
name: "Teste",
active: true)
@sector = Sector.new(active: true,
name: "Setor 1",
absence_max: 1,
blocking_days: 2,
cancel_limit: 3,
description: "number one",
schedules_by_sector: 3)
@professional = Professional.new(active: true,
registration: "123")
@citizen = Citizen.new(
cpf: "10845922904",
active: true,
birth_date: "Apr 18 1997",
cep: "1234567",
email: "test@example.com",
name: "Test Example",
phone1: "(12)1212-1212",
rg: "1234567",
city_id: @joinville.id
)
@account = Account.new(
uid: @citizen.cpf,
password: "123mudar",
password_confirmation: "123mudar"
)
@account.save!
@citizen.account_id = @account.id
@citizen.save!
@city_hall = CityHall.new(
name: "Prefeitura de Joinville",
cep: "81530110",
neighborhood: "Aasdsd",
address_street: "asdasd",
address_number: "100",
city_id: @joinville.id,
phone1: "12121212",
active: true,
block_text: "hello"
)
@city_hall.save!
@occupation = Occupation.new(
description: "Cargo",
name: "Teste",
active: true
)
@occupation.city_hall_id = @city_hall.id
@occupation.save!
@professional.account_id = @account.id
@professional.occupation_id = @occupation.id
@professional.save!
@sector = Sector.new(
active: true,
name: "Setor 1",
absence_max: 1,
blocking_days: 2,
cancel_limit: 3,
description: "number one",
schedules_by_sector: 3
)
@sector.city_hall = @city_hall
@sector.save!
@service_type = ServiceType.new(active: true,
description: "type one")
@professional = Professional.new(
active: true,
registration: "123"
)
@professional.account_id = @account.id
@professional.occupation_id = @occupation.id
@professional.save!
@service_type = ServiceType.new(
active: true,
description: "type one"
)
@service_type.sector = @sector
@service_place = ServicePlace.new(active: true,
address_number: "123",
address_street: "Test Avenue",
name: "Example SP",
neighborhood:"Neighborhood Example")
@service_place = ServicePlace.new(
active: true,
address_number: "123",
address_street: "Test Avenue",
name: "Example SP",
neighborhood:"Neighborhood Example"
)
@service_place.city_hall = @city_hall
@service_place.save!
@service_type.save!