Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename fixtures associated with org_dogs_test integration test file #156

Merged
merged 17 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/fixtures/adopter_accounts.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

adopter_account_one:
user: user_one
user: adopter_with_profile
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved

adopter_account_two:
user: user_four
user: adopter_without_profile
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved

# two:
# user: two
4 changes: 2 additions & 2 deletions test/fixtures/adopter_applications.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

adopter_application_one:
dog: dog_one
dog: pending_adoption_one
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved
adopter_account: adopter_account_one
status: 2

Expand All @@ -10,7 +10,7 @@ adopter_application_two:
adopter_account: adopter_account_one

adopter_application_three:
dog: dog_two
dog: adopted_dog
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved
adopter_account: adopter_account_one
profile_show: false
status: 3 # withdrawn
2 changes: 1 addition & 1 deletion test/fixtures/adoptions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

adoption_one:
dog: dog_two
dog: adopted_dog
adopter_account: adopter_account_one
4 changes: 2 additions & 2 deletions test/fixtures/dogs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

dog_one:
pending_adoption_one:
organization: organization_one
name: Deleted
age: 5
breed: mix
application_paused: false

dog_two:
adopted_dog:
organization: organization_one
name: Adopted
age: 4
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/staff_accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
# below each fixture, per the syntax in the comments below
#
staff_account_one:
user: user_two
user: verified_staff_one
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved
organization: organization_one
verified: true

staff_account_two:
user: user_three
user: unverified_staff
Eduardo06sp marked this conversation as resolved.
Show resolved Hide resolved
organization: organization_three
verified: false

staff_account_three:
user: user_five
user: verified_staff_two
organization: organization_one
verified: true

Expand Down
10 changes: 5 additions & 5 deletions test/fixtures/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@
#

# adopter with a profile
user_one:
adopter_with_profile:
first_name: Ben
last_name: Jo
email: test@test.com
encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
tos_agreement: 1

# verified staff
user_two:
verified_staff_one:
first_name: Staffy
last_name: McStaffface
email: testes@test.com
encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
tos_agreement: 1

# unverified staff
user_three:
unverified_staff:
first_name: unverified
last_name: McStaffface
email: testes@testes.com
encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
tos_agreement: 1

# adopter without a profile
user_four:
adopter_without_profile:
first_name: Billy
last_name: Noprofile
email: test@test123.com
encrypted_password: <%= Devise::Encryptor.digest(User, 'password') %>
tos_agreement: 1

# verified staff
user_five:
verified_staff_two:
first_name: Jimmy
last_name: Hendrix
email: purple@haze.com
Expand Down
2 changes: 1 addition & 1 deletion test/integration/CTA_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CTATest < ActionDispatch::IntegrationTest
end

test "homepage CTA section above footer does not exists when authenticated" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get '/'
assert_select 'section#cta', false
end
Expand Down
20 changes: 10 additions & 10 deletions test/integration/adoptable_dog_show_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest

setup do
@dog_id = dogs(:dog_three).id
@adopted_dog_id = dogs(:dog_two).id
@adopted_dog_id = dogs(:adopted_dog).id
end

test "unauthenticated users see create account prompt and link" do
Expand All @@ -15,15 +15,15 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest
end

test "adopter without a profile sees complete my profile prompt and link" do
sign_in users(:user_four)
sign_in users(:adopter_without_profile)
get "/adoptable_dogs/#{@dog_id}"
assert_response :success
assert_select "h4", "Complete your profile to apply for this dog"
assert_select "a", "Complete my profile"
end

test "adopter with a profile sees love this pooch question and apply button" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get "/adoptable_dogs/#{@dog_id}"
assert_response :success
assert_select "h4", "In love with this pooch?"
Expand All @@ -33,7 +33,7 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest
end

test "staff do not see an adopt button only log out button" do
sign_in users(:user_two)
sign_in users(:verified_staff_one)
get "/adoptable_dogs/#{@dog_id}"
assert_response :success
assert_select 'form' do
Expand All @@ -43,7 +43,7 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest
end

test "if dog status is paused and reason is opening soon this is displayed" do
sign_in users(:user_two)
sign_in users(:verified_staff_one)

put "/dogs/#{@dog_id}",
params: { dog:
Expand All @@ -62,13 +62,13 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest
}

logout
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get "/adoptable_dogs/#{@dog_id}"
assert_select "h3", "Applications Opening Soon"
end

test "if dog status is paused and reason is paused until further notice this is displayed" do
sign_in users(:user_two)
sign_in users(:verified_staff_one)

put "/dogs/#{@dog_id}",
params: { dog:
Expand All @@ -86,15 +86,15 @@ class AdoptableDogShowTest < ActionDispatch::IntegrationTest
} }

logout
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get "/adoptable_dogs/#{@dog_id}"
assert_select "h3", "Applications Paused Until Further Notice"
end

test "dog name shows adoption pending if it has any applications with that status" do
@dog_id = dogs(:dog_one).id
@dog_id = dogs(:pending_adoption_one).id
get "/adoptable_dogs/#{@dog_id}"
assert_select 'h1', "#{dogs(:dog_one).name} (Adoption Pending)"
assert_select 'h1', "#{dogs(:pending_adoption_one).name} (Adoption Pending)"
end

test "an adopted dog can't be shown as an adoptable dog" do
Expand Down
2 changes: 1 addition & 1 deletion test/integration/adoptable_dogs_index_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ class AdoptableDogsIndexTest < ActionDispatch::IntegrationTest

test "dog name shows adoption pending if it has any applications with that status" do
get '/adoptable_dogs'
assert_select 'h3', "#{dogs(:dog_one).name} (Adoption Pending)"
assert_select 'h3', "#{dogs(:pending_adoption_one).name} (Adoption Pending)"
end
end
8 changes: 4 additions & 4 deletions test/integration/adopter_application_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AdopterApplicationTest < ActionDispatch::IntegrationTest
end

test "adopter user without profile cannot apply for dog and sees flash error" do
sign_in users(:user_four)
sign_in users(:adopter_without_profile)
before_count = AdopterApplication.all.count

post '/create_my_application',
Expand All @@ -27,7 +27,7 @@ class AdopterApplicationTest < ActionDispatch::IntegrationTest
end

test "staff user sees flash error if they apply for a dog" do
sign_in users(:user_two)
sign_in users(:verified_staff_one)
before_count = AdopterApplication.all.count

post '/create_my_application',
Expand All @@ -46,7 +46,7 @@ class AdopterApplicationTest < ActionDispatch::IntegrationTest
end

test "adopter user with profile can apply for a dog and staff receive email" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
before_count = AdopterApplication.all.count

post '/create_my_application',
Expand All @@ -69,7 +69,7 @@ class AdopterApplicationTest < ActionDispatch::IntegrationTest
end

test "adopter user with profile cannot apply for a paused dog and sees flash error" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
before_count = AdopterApplication.all.count

post '/create_my_application',
Expand Down
22 changes: 11 additions & 11 deletions test/integration/adopter_applications_page_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest

setup do
@application_id = adopter_applications(:adopter_application_one).id
@visible_applications = users(:user_one)
@visible_applications = users(:adopter_with_profile)
.adopter_account
.adopter_applications
.where.not(status: ['adoption_made'])
.where(profile_show: true)
end

test "Adopter without profile cannot access adopter applications route" do
sign_in users(:user_four)
sign_in users(:adopter_without_profile)

get '/my_applications'

Expand All @@ -22,7 +22,7 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
end

test "Adopter with profile can access adopter applications route and see applications" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

get '/my_applications'

Expand All @@ -38,7 +38,7 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
end

test "Adopter with account can withdraw an application and see remove button" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

patch '/my_application',
params: { application:
Expand All @@ -63,7 +63,7 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
end

test "Adopter with account can remove an application from the page" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

patch '/my_application',
params: { application:
Expand All @@ -86,14 +86,14 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
end

test "Adoption status changes when staff change the application status" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

get '/my_applications'
assert_response :success
assert_select 'p', 'Status: Awaiting Review'

logout
sign_in users(:user_two)
sign_in users(:verified_staff_one)

patch "/adopter_applications/#{@application_id}",
params: { adopter_application:
Expand All @@ -103,15 +103,15 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
}

logout
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

get '/my_applications'
assert_response :success
assert_select 'p', 'Status: Adoption Pending'
end

test "Staff can revert withdraw and remove by an adopter and the application reappears for adopter" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)

get '/my_applications'
assert_response :success
Expand All @@ -132,7 +132,7 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
assert_select 'form', { count: @visible_applications.reload.count + 1 }
logout

sign_in users(:user_two)
sign_in users(:verified_staff_one)
patch "/adopter_applications/#{@application_id}",
params: { adopter_application:
{
Expand All @@ -142,7 +142,7 @@ class AdopterApplicationsPageTest < ActionDispatch::IntegrationTest
}

logout
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get '/my_applications'
assert_response :success
assert_select 'form', { count: @visible_applications.reload.count + 1 }
Expand Down
10 changes: 5 additions & 5 deletions test/integration/adopter_profile_form_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
class AdopterProfileFormTest < ActionDispatch::IntegrationTest

setup do
@adopter_account_id = users(:user_four).adopter_account.id
@adopter_account_id = users(:adopter_without_profile).adopter_account.id
end

test "All errors and their custom messages appear on blank form submission" do
sign_in users(:user_four)
sign_in users(:adopter_without_profile)
post '/adopter_profile',
params: { adopter_profile:
{
Expand Down Expand Up @@ -76,7 +76,7 @@ class AdopterProfileFormTest < ActionDispatch::IntegrationTest
end

test "Phone number with less than 8 digits is invalid" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
put '/adopter_profile',
params: { adopter_profile:
{
Expand All @@ -90,7 +90,7 @@ class AdopterProfileFormTest < ActionDispatch::IntegrationTest
end

test "Phone number with more than 10 digits is invalid" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
put '/adopter_profile',
params: { adopter_profile:
{
Expand All @@ -105,7 +105,7 @@ class AdopterProfileFormTest < ActionDispatch::IntegrationTest

# select dropdown options and selected value are tested in system test
test "Radio buttons are pre-populated with adopter selection on edit form" do
sign_in users(:user_one)
sign_in users(:adopter_with_profile)
get '/adopter_profile/edit'

a = assert_select 'form input[type=radio][id=adopter_profile_shared_ownership_false]'
Expand Down
Loading