diff --git a/spec/api/houdini/nonprofit_spec.rb b/spec/api/houdini/nonprofit_spec.rb index 080a28c1..769aa4c8 100644 --- a/spec/api/houdini/nonprofit_spec.rb +++ b/spec/api/houdini/nonprofit_spec.rb @@ -99,7 +99,7 @@ describe Houdini::V1::Nonprofit, type: :request do end it 'attempts to make a slug copy and returns the proper errors' do - force_create(:nonprofit, slug: 'n', state_code_slug: 'wi', city_slug: 'appleton') + force_create(:nm_justice, slug: 'n', state_code_slug: 'wi', city_slug: 'appleton') input = { nonprofit: { name: 'n', state_code: 'WI', city: 'appleton', zip_code: 54_915 }, user: { name: 'Name', email: 'em@em.com', password: '12345678', password_confirmation: '12345678' } @@ -140,7 +140,7 @@ describe Houdini::V1::Nonprofit, type: :request do end it 'succeeds' do - force_create(:nonprofit, slug: 'n', state_code_slug: 'wi', city_slug: 'appleton') + force_create(:nm_justice, slug: 'n', state_code_slug: 'wi', city_slug: 'appleton') input = { nonprofit: { name: 'n', state_code: 'WI', city: 'appleton', zip_code: 54_915, url: 'www.cs.c', website: 'www.cs.c' }, user: { name: 'Name', email: 'em@em.com', password: '12345678', password_confirmation: '12345678' } diff --git a/spec/controllers/campaigns_spec.rb b/spec/controllers/campaigns_spec.rb index 55d3b83d..f68b17f3 100644 --- a/spec/controllers/campaigns_spec.rb +++ b/spec/controllers/campaigns_spec.rb @@ -67,7 +67,7 @@ describe CampaignsController, type: :controller do describe 'index' do render_views - let(:nonprofit) { force_create(:nonprofit, published: true)} + let(:nonprofit) { force_create(:nm_justice, published: true)} let(:campaign) { force_create(:campaign, nonprofit: nonprofit, name: "simplename", goal_amount: 444)} before(:each) do @@ -85,7 +85,7 @@ describe CampaignsController, type: :controller do name: 'simplename', total_raised: 0, goal_amount: 444, - url: "///sluggy-sluggo/campaigns/slug_#{campaign.id}" + url: "/nm/albuquerque/new_mexican_equality/campaigns/slug_#{campaign.id}" }]}.with_indifferent_access) end end diff --git a/spec/controllers/support/shared_user_context.rb b/spec/controllers/support/shared_user_context.rb index 8abbaf63..fe9f29e6 100644 --- a/spec/controllers/support/shared_user_context.rb +++ b/spec/controllers/support/shared_user_context.rb @@ -3,8 +3,8 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later RSpec.shared_context :shared_user_context do - let(:nonprofit) { force_create(:nonprofit, published: true) } - let(:other_nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice, published: true) } + let(:other_nonprofit) { force_create(:fv_poverty) } let(:user_as_np_admin) do __create_admin(nonprofit) diff --git a/spec/factories/campaigns.rb b/spec/factories/campaigns.rb index 1b0d5fbe..bacc16ef 100644 --- a/spec/factories/campaigns.rb +++ b/spec/factories/campaigns.rb @@ -4,7 +4,7 @@ FactoryBot.define do factory :campaign do profile - nonprofit + nonprofit_id { 55352 } sequence(:name) { |i| "name #{i}" } sequence(:slug) { |i| "slug_#{i}" } end diff --git a/spec/factories/events.rb b/spec/factories/events.rb index e8a1e320..3c1013d7 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -10,7 +10,7 @@ FactoryBot.define do city { 'Appleton' } state_code { 'WI' } slug { 'event-of-wonders' } - nonprofit + nonprofit_id { 55352 } profile end end diff --git a/spec/factories/nonprofits.rb b/spec/factories/nonprofits.rb index 83a7a5b6..c31a44bd 100644 --- a/spec/factories/nonprofits.rb +++ b/spec/factories/nonprofits.rb @@ -2,24 +2,28 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later FactoryBot.define do - factory :nonprofit do - name { 'spec_nonprofit_full' } + factory :nm_justice, class: Nonprofit do + id { 55352 } + name { 'New Mexico Justice' } city { 'Albuquerque' } state_code { 'NM' } zip_code { 55_555 } - email { 'example@email.com' } - slug { 'sluggy-sluggo' } + email { 'nmj@gmail.com' } + slug { 'new_mexican_equality' } + state_code_slug { 'nm'} + city_slug { 'albuquerque'} + end - factory :nonprofit_with_cards do - after(:create) do |nonprofit, _evaluator| - create(:active_card_1, holder: nonprofit) - create(:active_card_2, holder: nonprofit) - create(:inactive_card, holder: nonprofit) - end - end - - after(:create) do |nonprofit, _evaluator| - create(:supporter, nonprofit: nonprofit) - end + factory :fv_poverty, class: Nonprofit do + id { 22352 } + name { 'Ending Poverty in the Fox Valley Inc.' } + city { 'Appleton' } + state_code { 'WI' } + zip_code { 54915 } + email { 'contact@endpovertyinthefoxvalleyinc.org' } + website {'https://endpovertyinthefoxvalleyinc.org'} + slug { 'end_poverty_in_the_fox_valley_inc' } + state_code_slug { 'wi'} + city_slug { 'appleton'} end end diff --git a/spec/factories/supporters.rb b/spec/factories/supporters.rb index 88223eef..caf124d7 100644 --- a/spec/factories/supporters.rb +++ b/spec/factories/supporters.rb @@ -4,8 +4,7 @@ FactoryBot.define do factory :supporter do name { 'Fake Supporter Name' } - nonprofit - + nonprofit_id { 55352 } trait :has_a_card do after(:create) do |supporter| create(:active_card_1, holder: supporter) diff --git a/spec/lib/cancel_billing_subscriptions_spec.rb b/spec/lib/cancel_billing_subscriptions_spec.rb index c2decba1..a467ba22 100644 --- a/spec/lib/cancel_billing_subscriptions_spec.rb +++ b/spec/lib/cancel_billing_subscriptions_spec.rb @@ -9,7 +9,7 @@ describe CancelBillingSubscription do before(:each) do StripeMock.start @card_token = StripeMock.generate_card_token(last4: '9191', exp_year: 2011) - @np = force_create(:nonprofit) + @np = force_create(:nm_justice) end after { StripeMock.stop } @@ -26,9 +26,6 @@ describe CancelBillingSubscription do end context 'with db' do - before(:each) do - @np = create(:nonprofit) - end it 'nonprofit valid but no card or billing_subscription' do result = CancelBillingSubscription.with_stripe(@np) diff --git a/spec/lib/create/create_campaign_gift_spec.rb b/spec/lib/create/create_campaign_gift_spec.rb index 85114c46..8745b0ce 100644 --- a/spec/lib/create/create_campaign_gift_spec.rb +++ b/spec/lib/create/create_campaign_gift_spec.rb @@ -47,7 +47,7 @@ describe CreateCampaignGift do describe 'donation and campaign gift option exist so we validate the details' do let(:profile) { force_create(:profile, user: force_create(:user)) } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:campaign) { force_create(:campaign, profile: profile, nonprofit: nonprofit) } let(:bad_campaign) { force_create(:campaign, profile: profile, nonprofit: nonprofit) } diff --git a/spec/lib/create/create_peer_to_peer_campaign_spec.rb b/spec/lib/create/create_peer_to_peer_campaign_spec.rb index 12b90074..4ab262a7 100644 --- a/spec/lib/create/create_peer_to_peer_campaign_spec.rb +++ b/spec/lib/create/create_peer_to_peer_campaign_spec.rb @@ -6,7 +6,7 @@ require 'rails_helper' describe CreatePeerToPeerCampaign do describe '.create' do let!(:profile) { force_create(:profile, user: force_create(:user)) } - let!(:parent_campaign) { force_create(:campaign, name: 'Parent campaign') } + let!(:parent_campaign) { force_create(:campaign, name: 'Parent campaign', nonprofit: force_create(:nm_justice)) } context 'on success' do it 'returns a hash' do diff --git a/spec/lib/export/export_payments_spec.rb b/spec/lib/export/export_payments_spec.rb index 13c3ad03..08a9c8e2 100644 --- a/spec/lib/export/export_payments_spec.rb +++ b/spec/lib/export/export_payments_spec.rb @@ -13,7 +13,7 @@ describe ExportPayments do let(:email) { 'example@example.com' } let(:user) { force_create(:user, email: email) } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:supporters) do [force_create(:supporter, name: 'supporter-0', nonprofit: nonprofit), force_create(:supporter, name: 'supporter-1', nonprofit: nonprofit)] diff --git a/spec/lib/export/export_recurring_donations_spec.rb b/spec/lib/export/export_recurring_donations_spec.rb index 756366f5..73a43012 100644 --- a/spec/lib/export/export_recurring_donations_spec.rb +++ b/spec/lib/export/export_recurring_donations_spec.rb @@ -9,7 +9,7 @@ describe ExportRecurringDonations do stub_const('CHUNKED_UPLOADER', TestChunkedUploader) @email = 'example@example.com' @user = force_create(:user, email: @email) - @nonprofit = force_create(:nonprofit) + @nonprofit = force_create(:nm_justice) @supporters = [force_create(:supporter, name: 'supporter-0', nonprofit: @nonprofit), force_create(:supporter, name: 'supporter-1', nonprofit: @nonprofit)] @donations = [force_create(:donation, nonprofit: @nonprofit, supporter: @supporters[0]), diff --git a/spec/lib/export/export_supporter_notes_spec.rb b/spec/lib/export/export_supporter_notes_spec.rb index 444cd798..91aa0566 100644 --- a/spec/lib/export/export_supporter_notes_spec.rb +++ b/spec/lib/export/export_supporter_notes_spec.rb @@ -13,7 +13,7 @@ describe ExportSupporterNotes do CHUNKED_UPLOADER.clear end - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:supporter1) { force_create(:supporter, nonprofit: nonprofit) } let(:supporter2) { force_create(:supporter, nonprofit: nonprofit) } diff --git a/spec/lib/export/export_supporters_spec.rb b/spec/lib/export/export_supporters_spec.rb index c995e8fe..7723b597 100644 --- a/spec/lib/export/export_supporters_spec.rb +++ b/spec/lib/export/export_supporters_spec.rb @@ -7,7 +7,7 @@ require 'support/test_chunked_uploader' describe ExportSupporters do before(:each) do stub_const('CHUNKED_UPLOADER', TestChunkedUploader) - @nonprofit = force_create(:nonprofit) + @nonprofit = force_create(:nm_justice) @email = 'example@example.com' @user = force_create(:user, email: @email) @supporters = 2.times { force_create(:supporter, nonprofit: @nonprofit) } diff --git a/spec/lib/fetch/fetch_misc_nonprofit_settings_spec.rb b/spec/lib/fetch/fetch_misc_nonprofit_settings_spec.rb index a80916c7..29ac1e27 100644 --- a/spec/lib/fetch/fetch_misc_nonprofit_settings_spec.rb +++ b/spec/lib/fetch/fetch_misc_nonprofit_settings_spec.rb @@ -24,7 +24,7 @@ describe FetchMiscellaneousNpInfo do describe 'with valid nonprofit' do before(:each) do - @np = force_create(:nonprofit) + @np = force_create(:nm_justice) end it 'returns hash with empty misc settings' do diff --git a/spec/lib/insert/insert_bank_account_spec.rb b/spec/lib/insert/insert_bank_account_spec.rb index 4017bd2c..9cb3491b 100644 --- a/spec/lib/insert/insert_bank_account_spec.rb +++ b/spec/lib/insert/insert_bank_account_spec.rb @@ -14,7 +14,7 @@ describe InsertBankAccount do Timecop.return end - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:user) { force_create(:user, email: 'x@example.com') } describe '.with_stripe' do diff --git a/spec/lib/insert/insert_card_spec.rb b/spec/lib/insert/insert_card_spec.rb index 825b0137..f7479c2f 100644 --- a/spec/lib/insert/insert_card_spec.rb +++ b/spec/lib/insert/insert_card_spec.rb @@ -22,7 +22,7 @@ describe InsertCard do } end - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:user) do user = force_create(:user) force_create(:role, name: :nonprofit_admin, host: nonprofit, user: user) @@ -396,7 +396,7 @@ describe InsertCard do end it 'should return proper error when event doesnt match the supporters nonprofit' do - supporter2 = force_create(:supporter) + supporter2 = force_create(:supporter, nonprofit: force_create(:fv_poverty)) ret = InsertCard.with_stripe({ holder_id: supporter2.id, holder_type: 'Supporter', stripe_card_id: 'card_fafjeht', stripe_card_token: stripe_card_token, name: 'name' }, nil, event.id, user_not_from_nonprofit) expect(ret).to eq(status: :unprocessable_entity, json: { error: "Oops! There was an error: Event #{event.id} is not for the same nonprofit as supporter #{supporter2.id}" }) end diff --git a/spec/lib/insert/insert_custom_field_joins_spec.rb b/spec/lib/insert/insert_custom_field_joins_spec.rb index 6a79ef43..8c3d94fa 100644 --- a/spec/lib/insert/insert_custom_field_joins_spec.rb +++ b/spec/lib/insert/insert_custom_field_joins_spec.rb @@ -5,8 +5,8 @@ require 'rails_helper' describe InsertCustomFieldJoins do describe '.find_or_create' do - let(:nonprofit) { force_create(:nonprofit) } - let(:other_nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } + let(:other_nonprofit) { force_create(:fv_poverty) } let(:supporter) { force_create(:supporter, nonprofit: nonprofit) } let(:other_supporter) { force_create(:supporter, nonprofit: other_nonprofit) } @@ -95,8 +95,8 @@ describe InsertCustomFieldJoins do end context 'requiring db' do before(:each) do - @nonprofit = force_create(:nonprofit) - @bad_nonprofit = force_create(:nonprofit, id: 50) + @nonprofit = force_create(:nm_justice) + @bad_nonprofit = force_create(:fv_poverty, id: 50) end it 'nonprofit must be valid' do response = InsertCustomFieldJoins.in_bulk(@nonprofit.id + 1, [], []) @@ -118,11 +118,11 @@ describe InsertCustomFieldJoins do context 'main testing' do before(:each) do - @nonprofit = force_create(:nonprofit) + @nonprofit = force_create(:nm_justice) + @other_nonprofit = force_create(:fv_poverty) + @random_supporter = create(:supporter, nonprofit: @other_nonprofit) - @random_supporter = create(:supporter) - - @other_nonprofit = force_create(:nonprofit) + @delete_cfm = [20, 40, 60] @add_cfm = [25, 35] diff --git a/spec/lib/insert/insert_duplicate_spec.rb b/spec/lib/insert/insert_duplicate_spec.rb index ad9e6aaa..620c1038 100644 --- a/spec/lib/insert/insert_duplicate_spec.rb +++ b/spec/lib/insert/insert_duplicate_spec.rb @@ -11,7 +11,7 @@ describe InsertDuplicate do after(:all) do Timecop.return end - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:profile) { force_create(:profile) } let(:dates) do { diff --git a/spec/lib/insert/insert_payout_spec.rb b/spec/lib/insert/insert_payout_spec.rb index 831534e2..bbec4b01 100644 --- a/spec/lib/insert/insert_payout_spec.rb +++ b/spec/lib/insert/insert_payout_spec.rb @@ -52,7 +52,7 @@ describe InsertPayout do end it 'handles no charges to payout' do - np = force_create(:nonprofit) + np = force_create(:nm_justice) expect { InsertPayout.with_stripe(np.id, { stripe_account_id: 'valid', email: 'valid', user_ip: 'valid', bank_name: 'valid' }, nil) }.to(raise_error do |error| expect(error).to be_a ArgumentError expect(error.message).to eq 'No payments are available for disbursal on this account.' @@ -73,7 +73,7 @@ describe InsertPayout do context 'no date provided' do include_context 'payments for a payout' do - let(:np) { force_create(:nonprofit, stripe_account_id: Stripe::Account.create['id'], vetted: true) } + let(:np) { force_create(:nm_justice, stripe_account_id: Stripe::Account.create['id'], vetted: true) } let(:date_for_marking) { Time.now } let(:ba) do InsertBankAccount.with_stripe(np, user, stripe_bank_account_token: StripeMock.generate_bank_token, name: bank_name) @@ -204,7 +204,7 @@ describe InsertPayout do context 'previous date provided' do include_context 'payments for a payout' do - let(:np) { force_create(:nonprofit, stripe_account_id: Stripe::Account.create['id'], vetted: true) } + let(:np) { force_create(:nm_justice, stripe_account_id: Stripe::Account.create['id'], vetted: true) } let(:date_for_marking) { Time.now - 1.day } let(:ba) { InsertBankAccount.with_stripe(np, user, stripe_bank_account_token: StripeMock.generate_bank_token, name: bank_name) } end diff --git a/spec/lib/insert/insert_recurring_donation_spec.rb b/spec/lib/insert/insert_recurring_donation_spec.rb index 1bb1fe5e..acdb359d 100644 --- a/spec/lib/insert/insert_recurring_donation_spec.rb +++ b/spec/lib/insert/insert_recurring_donation_spec.rb @@ -160,7 +160,7 @@ describe InsertRecurringDonation do describe 'wonderful testing Eric' do before(:each) { Timecop.freeze(2020, 4, 29) } after(:each) { Timecop.return } - let(:nonprofit) { force_create(:nonprofit, state_code_slug: 'wi', city_slug: 'city', slug: 'sluggster') } + let(:nonprofit) { force_create(:nm_justice, state_code_slug: 'wi', city_slug: 'city', slug: 'sluggster') } let(:profile) { force_create(:profile, user: force_create(:user)) } let(:supporter) { force_create(:supporter, nonprofit: nonprofit) } let(:card) { force_create(:card, holder: supporter) } @@ -224,7 +224,7 @@ describe InsertRecurringDonation do describe 'test for earlier in the month' do before(:each) { Timecop.freeze(2020, 4, 5) } after(:each) { Timecop.return } - let(:nonprofit) { force_create(:nonprofit, state_code_slug: 'wi', city_slug: 'city', slug: 'sluggster') } + let(:nonprofit) { force_create(:nm_justice, state_code_slug: 'wi', city_slug: 'city', slug: 'sluggster') } let(:profile) { force_create(:profile, user: force_create(:user)) } let(:supporter) { force_create(:supporter, nonprofit: nonprofit) } let(:card) { force_create(:card, holder: supporter) } diff --git a/spec/lib/insert/insert_tag_joins_spec.rb b/spec/lib/insert/insert_tag_joins_spec.rb index bea7b120..f5113b62 100644 --- a/spec/lib/insert/insert_tag_joins_spec.rb +++ b/spec/lib/insert/insert_tag_joins_spec.rb @@ -21,7 +21,7 @@ describe 'InsertTagJoins.in_bulk' do end context 'requiring db' do before do - @nonprofit = force_create(:nonprofit) + @nonprofit = force_create(:nm_justice) @profile = force_create(:profile) end @@ -46,12 +46,12 @@ describe 'InsertTagJoins.in_bulk' do context 'supporters tags' do before(:each) do - @nonprofit = force_create(:nonprofit) + @nonprofit = force_create(:nm_justice) @profile = force_create(:profile) + @other_nonprofit = force_create(:fv_poverty) + @random_supporter = create(:supporter, nonprofit: @other_nonprofit) - @random_supporter = create(:supporter) - - @other_nonprofit = force_create(:nonprofit) + @delete_tags = [20, 40, 60] @add_tags = [25, 35] diff --git a/spec/lib/mailchimp_spec.rb b/spec/lib/mailchimp_spec.rb index d3867c50..7ac36cb7 100644 --- a/spec/lib/mailchimp_spec.rb +++ b/spec/lib/mailchimp_spec.rb @@ -10,7 +10,7 @@ describe Mailchimp do { id: 'on_mailchimp', email_address: 'on_mailchimp@email.com' }] end - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let(:tag_master) { force_create(:tag_master, nonprofit: np) } let(:email_list) { force_create(:email_list, mailchimp_list_id: 'list_id', tag_master: tag_master, nonprofit: np, list_name: 'temp') } let(:supporter_on_both) { force_create(:supporter, nonprofit: np, email: 'on_BOTH@email.com') } diff --git a/spec/lib/merge_supporters_spec.rb b/spec/lib/merge_supporters_spec.rb index 63da0f1f..8864bef6 100644 --- a/spec/lib/merge_supporters_spec.rb +++ b/spec/lib/merge_supporters_spec.rb @@ -17,7 +17,7 @@ describe MergeSupporters do # one unique custom field on 2 # one common field on both and keep the value of the most common - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let(:old_supporter1) { force_create(:supporter, nonprofit: np) } let(:old_supporter2) { force_create(:supporter, nonprofit: np) } let(:new_supporter) { force_create(:supporter, nonprofit: np) } diff --git a/spec/lib/name_copy_naming_algorithm_spec.rb b/spec/lib/name_copy_naming_algorithm_spec.rb index 39731602..50ab00af 100644 --- a/spec/lib/name_copy_naming_algorithm_spec.rb +++ b/spec/lib/name_copy_naming_algorithm_spec.rb @@ -27,7 +27,7 @@ describe NameCopyNamingAlgorithm do let(:long_name_copy_today_plus_1) { "#{long_name_copy_today_base} 01" } let(:long_name_copy_yesterday) { 'campaign_name is so long that it must b (2020-05-03 copy) 00' } let(:long_name_copy_today_base) { 'campaign_name is so long that it must b (2020-05-04 copy)' } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } describe 'events' do let(:event) { force_create(:event, name: @name, nonprofit: nonprofit) } diff --git a/spec/lib/query/billing_plans_spec.rb b/spec/lib/query/billing_plans_spec.rb index edaa0bb5..04531032 100644 --- a/spec/lib/query/billing_plans_spec.rb +++ b/spec/lib/query/billing_plans_spec.rb @@ -10,7 +10,7 @@ describe BillingPlans do end let(:nonprofit) do - force_create(:nonprofit) + force_create(:nm_justice) end describe '.get_percentage_fee' do diff --git a/spec/lib/query/query_campaign_gifts_spec.rb b/spec/lib/query/query_campaign_gifts_spec.rb index 65b4e010..90f3ee8c 100644 --- a/spec/lib/query/query_campaign_gifts_spec.rb +++ b/spec/lib/query/query_campaign_gifts_spec.rb @@ -8,7 +8,7 @@ describe QueryCampaignGifts do GIFT_LEVEL_RECURRING = 5585 GIFT_LEVEL_CHANGED_RECURRING = 5512 CAMPAIGN_GIFT_OPTION_NAME = 'theowthoinv' - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let(:supporter1) { force_create(:supporter, nonprofit: np) } let(:supporter2) { force_create(:supporter, nonprofit: np) } let(:campaign) { force_create(:campaign, nonprofit: np, slug: 'slug stuff') } diff --git a/spec/lib/query/query_campaign_metrics_spec.rb b/spec/lib/query/query_campaign_metrics_spec.rb index 60cadcf6..4ba16c5e 100644 --- a/spec/lib/query/query_campaign_metrics_spec.rb +++ b/spec/lib/query/query_campaign_metrics_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe QueryCampaignMetrics do describe 'calculates your metrics plus children' do - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:campaign) { force_create(:campaign, nonprofit: nonprofit, show_total_count: false, show_total_raised: false, goal_amount: 16_000) } let(:campaign_child) { force_create(:campaign, nonprofit: nonprofit, parent_campaign: campaign, show_total_count: true, show_total_raised: true, goal_amount: 8000) } diff --git a/spec/lib/query/query_donations_spec.rb b/spec/lib/query/query_donations_spec.rb index 531a01d3..ff601087 100644 --- a/spec/lib/query/query_donations_spec.rb +++ b/spec/lib/query/query_donations_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe QueryDonations do describe 'campaign_export' do - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:supporter) { force_create(:supporter) } let(:profile_email) { 'something@profile_email.com' } diff --git a/spec/lib/query/query_payments_spec.rb b/spec/lib/query/query_payments_spec.rb index e3159dce..a1ff0f4d 100644 --- a/spec/lib/query/query_payments_spec.rb +++ b/spec/lib/query/query_payments_spec.rb @@ -6,7 +6,7 @@ require 'support/payments_for_a_payout' describe QueryPayments do before :each do - @nonprofit = force_create(:nonprofit, name: 'npo1') + @nonprofit = force_create(:nm_justice, name: 'npo1', id: 515152) @supporters = [force_create(:supporter, name: 'supporter-0', nonprofit: @nonprofit), force_create(:supporter, name: 'supporter-1', nonprofit: @nonprofit)] diff --git a/spec/lib/query/query_recurring_donations_spec.rb b/spec/lib/query/query_recurring_donations_spec.rb index 27f38dd6..b1451109 100644 --- a/spec/lib/query/query_recurring_donations_spec.rb +++ b/spec/lib/query/query_recurring_donations_spec.rb @@ -30,7 +30,7 @@ describe QueryRecurringDonations do end describe '.is_due?' do - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:supporter) { force_create(:supporter, nonprofit: nonprofit) } let(:donation) do force_create(:donation, amount: 1000, supporter: supporter, recurring: true, nonprofit: nonprofit) @@ -156,7 +156,7 @@ describe QueryRecurringDonations do describe '.for_export_enumerable' do before :each do - @nonprofit = force_create(:nonprofit, name: 'npo1') + @nonprofit = force_create(:nm_justice, name: 'npo1') @supporters = [force_create(:supporter, name: 'supporter-0', nonprofit: @nonprofit), force_create(:supporter, name: 'supporter-1', nonprofit: @nonprofit)] diff --git a/spec/lib/query/query_source_token_spec.rb b/spec/lib/query/query_source_token_spec.rb index 43cec772..d8a0fa6b 100644 --- a/spec/lib/query/query_source_token_spec.rb +++ b/spec/lib/query/query_source_token_spec.rb @@ -11,7 +11,7 @@ describe QuerySourceToken do let(:expired_uuid) { '061124ca-05f1-11e8-8730-57558ad1064d' } let(:overused_uuid) { '0ac67006-05f1-11e8-902c-035df51dbc79' } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:event) { force_create(:event, nonprofit: nonprofit) } let(:user) do u = force_create(:user) diff --git a/spec/lib/query/query_supporters_spec.rb b/spec/lib/query/query_supporters_spec.rb index 29eea440..b75e5578 100644 --- a/spec/lib/query/query_supporters_spec.rb +++ b/spec/lib/query/query_supporters_spec.rb @@ -9,7 +9,7 @@ describe QuerySupporters do let(:gift_level_changed_recurring) { 5512 } let(:campaign_gift_option_name) { 'theowthoinv' } - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let(:supporter1) { force_create(:supporter, nonprofit: np) } let(:supporter2) { force_create(:supporter, nonprofit: np) } let(:campaign) { force_create(:campaign, nonprofit: np, slug: 'slug stuff') } diff --git a/spec/lib/retrieve/retrieve_active_record_items_spec.rb b/spec/lib/retrieve/retrieve_active_record_items_spec.rb index 0febb832..924686c6 100644 --- a/spec/lib/retrieve/retrieve_active_record_items_spec.rb +++ b/spec/lib/retrieve/retrieve_active_record_items_spec.rb @@ -6,7 +6,7 @@ require 'rails_helper' describe RetrieveActiveRecordItems do describe '.retrieve' do let(:item) { force_create(:supporter) } - let(:item2) { force_create(:nonprofit) } + let(:item2) { force_create(:nm_justice) } it 'raises if not a class for key' do expect { RetrieveActiveRecordItems.retrieve('item' => 1) }.to raise_error(ArgumentError) end @@ -41,7 +41,7 @@ describe RetrieveActiveRecordItems do describe '.retrieve_from_keys' do let(:item) { force_create(:supporter) } - let(:item2) { force_create(:nonprofit) } + let(:item2) { force_create(:nm_justice) } it 'raises if not a class for key' do expect { RetrieveActiveRecordItems.retrieve_from_keys({}, 'item' => 1) }.to raise_error(ArgumentError) end diff --git a/spec/lib/slug_copy_naming_algorithm_spec.rb b/spec/lib/slug_copy_naming_algorithm_spec.rb index 9fa629eb..3068c7e3 100644 --- a/spec/lib/slug_copy_naming_algorithm_spec.rb +++ b/spec/lib/slug_copy_naming_algorithm_spec.rb @@ -21,7 +21,7 @@ describe SlugCopyNamingAlgorithm do let(:short_slug_copy_today_plus_1) { 'slug_name_copy_01' } let(:copy_base) { 'slug_name_copy' } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } describe 'events' do let(:event) { force_create(:event, slug: @name, nonprofit: nonprofit) } diff --git a/spec/lib/slug_nonprofit_naming_algorithm_spec.rb b/spec/lib/slug_nonprofit_naming_algorithm_spec.rb index 3cd05138..9074c59f 100644 --- a/spec/lib/slug_nonprofit_naming_algorithm_spec.rb +++ b/spec/lib/slug_nonprofit_naming_algorithm_spec.rb @@ -27,10 +27,10 @@ describe SlugNonprofitNamingAlgorithm do let(:not_our_city_slug) { 'not_our_city_slug' } describe 'nonprofits' do - let(:nonprofit) { force_create(:nonprofit, slug: @name, state_code_slug: state_slug, city_slug: city_slug) } - let(:nonprofit2) { force_create(:nonprofit, slug: @name2, state_code_slug: state_slug, city_slug: city_slug) } - let(:nonprofit_in_other_city) { force_create(:nonprofit, slug: @name, state_code_slug: state_slug, city_slug: not_our_city_slug) } - let(:nonprofit_in_other_state) { force_create(:nonprofit, slug: @name, state_code_slug: not_our_state_slug, city_slug: city_slug) } + let(:nonprofit) { force_create(:nm_justice, slug: @name, state_code_slug: state_slug, city_slug: city_slug) } + let(:nonprofit2) { force_create(:fv_poverty, slug: @name2, state_code_slug: state_slug, city_slug: city_slug) } + let(:nonprofit_in_other_city) { force_create(:nm_justice, slug: @name, state_code_slug: state_slug, city_slug: not_our_city_slug, id: 523950250) } + let(:nonprofit_in_other_state) { force_create(:fv_poverty, slug: @name, state_code_slug: not_our_state_slug, city_slug: city_slug, id: 5239502) } let(:nonprofit_at_max_copies) do (0..99).collect do |i| force_create(:nonprofit, slug: "#{@copy_base}-#{format('%02d', i)}", state_code_slug: state_slug, city_slug: city_slug) diff --git a/spec/lib/slug_p2p_campaign_naming_algorithm_spec.rb b/spec/lib/slug_p2p_campaign_naming_algorithm_spec.rb index 4ce8a9ea..f3321155 100644 --- a/spec/lib/slug_p2p_campaign_naming_algorithm_spec.rb +++ b/spec/lib/slug_p2p_campaign_naming_algorithm_spec.rb @@ -21,7 +21,7 @@ describe SlugP2pCampaignNamingAlgorithm do let(:short_slug_copy_today_plus_1) { 'slug_name_001' } let(:copy_base) { 'slug_name' } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } describe 'campaigns' do let(:campaign) { force_create(:campaign, slug: @name, nonprofit: nonprofit, deleted: true) } diff --git a/spec/lib/stripe_account_spec.rb b/spec/lib/stripe_account_spec.rb index a41c5f0e..cb4f6c87 100644 --- a/spec/lib/stripe_account_spec.rb +++ b/spec/lib/stripe_account_spec.rb @@ -9,7 +9,7 @@ describe StripeAccount do let(:stripe_helper) { StripeMock.create_test_helper } before(:each) { StripeMock.start } after(:each) { StripeMock.stop } - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } describe '.find_or_create' do describe 'param validation' do diff --git a/spec/lib/update/update_donation_spec.rb b/spec/lib/update/update_donation_spec.rb index 126d3012..732664cd 100644 --- a/spec/lib/update/update_donation_spec.rb +++ b/spec/lib/update/update_donation_spec.rb @@ -11,8 +11,8 @@ describe UpdateDonation do after do Timecop.return end - let(:np) { force_create(:nonprofit) } - let(:supporter) { force_create(:supporter, nonprofit: np) } + let(:np) { force_create(:nm_justice) } + let(:supporter) { force_create(:supporter) } let(:donation) do force_create(:donation, nonprofit: np, dedication: initial_dedication, @@ -48,10 +48,10 @@ describe UpdateDonation do fee_total: initial_fee, net_amount: initial_amount - initial_fee) end - let(:campaign) { force_create(:campaign, nonprofit: np) } - let(:event) { force_create(:event, nonprofit: np) } - let(:other_campaign) { force_create(:campaign) } - let(:other_event) { force_create(:event) } + let(:campaign) { force_create(:campaign) } + let(:event) { force_create(:event) } + let(:other_campaign) { force_create(:campaign, nonprofit: force_create(:fv_poverty)) } + let(:other_event) { force_create(:event, nonprofit: force_create(:fv_poverty)) } let(:initial_date) { Date.new(2020, 4, 5).to_time } let(:initial_dedication) { 'initial dedication' } diff --git a/spec/lib/update/update_misc_nonprofit_settings_spec.rb b/spec/lib/update/update_misc_nonprofit_settings_spec.rb index 8761b09f..429eed44 100644 --- a/spec/lib/update/update_misc_nonprofit_settings_spec.rb +++ b/spec/lib/update/update_misc_nonprofit_settings_spec.rb @@ -25,7 +25,7 @@ describe UpdateMiscellaneousNpInfo do end describe 'main' do - let!(:np) { force_create(:nonprofit) } + let!(:np) { force_create(:nm_justice) } let (:working_message) { '
working message
' } it 'sets change_amount_message to nil if empty tags' do expect(MiscellaneousNpInfo.count).to eq 0 diff --git a/spec/lib/update/update_payouts_spec.rb b/spec/lib/update/update_payouts_spec.rb index 82229d63..652fa7ac 100644 --- a/spec/lib/update/update_payouts_spec.rb +++ b/spec/lib/update/update_payouts_spec.rb @@ -49,7 +49,7 @@ describe UpdatePayouts do let!(:refunds) { [force_create(:refund, charge: charges.last, payment: reverse_payment_for_refund, disbursed: true)] } - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let!(:bank_account) { force_create(:bank_account, nonprofit: np) } let!(:payout) do force_create(:payout, status: 'paid', failure_message: 'all good', diff --git a/spec/lib/update/update_recurring_donations_spec.rb b/spec/lib/update/update_recurring_donations_spec.rb index 53fa9b5b..6b193733 100644 --- a/spec/lib/update/update_recurring_donations_spec.rb +++ b/spec/lib/update/update_recurring_donations_spec.rb @@ -6,10 +6,8 @@ require 'rails_helper' describe UpdateRecurringDonations do # deactivate a recurring donation describe '.cancel' do - before(:each) do - end - let(:np) { force_create(:nonprofit) } + let(:np) { force_create(:nm_justice) } let(:s) { force_create(:supporter) } let(:donation) { force_create(:donation, nonprofit_id: np.id, supporter_id: s.id) } let(:email) { 'test@test.com' } diff --git a/spec/mailers/admin_spec.rb b/spec/mailers/admin_spec.rb index ae29077f..b6f130f9 100644 --- a/spec/mailers/admin_spec.rb +++ b/spec/mailers/admin_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' RSpec.describe AdminMailer, type: :mailer do describe 'notify_failed_gift' do - let!(:np) { force_create(:nonprofit, name: 'nonprofit', email: 'blah', timezone: 'UTC') } + let!(:np) { force_create(:nm_justice, name: 'nonprofit', email: 'blah', timezone: 'UTC') } let!(:s) { force_create(:supporter, email: 'supporter.email@mail.teha') } let!(:oldcard) { force_create(:card) } let!(:donation) { force_create(:donation, nonprofit_id: np.id, supporter_id: s.id, card_id: oldcard.id, amount: 999) } diff --git a/spec/mailers/donation_mailer_spec.rb b/spec/mailers/donation_mailer_spec.rb index 898ee256..9eb4c2f3 100644 --- a/spec/mailers/donation_mailer_spec.rb +++ b/spec/mailers/donation_mailer_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' RSpec.describe DonationMailer, type: :mailer do describe 'donor_recurring_donation_change_amount' do - let(:np) { force_create(:nonprofit, name: 'nonprofit', email: 'blah') } + let(:np) { force_create(:nm_justice, name: 'nonprofit', email: 'blah') } let(:s) { force_create(:supporter, email: 'supporter.email@mail.teha') } let(:oldcard) { force_create(:card) } let(:donation) { create(:donation, nonprofit_id: np.id, supporter_id: s.id, card_id: oldcard.id, amount: 999) } diff --git a/spec/models/campaign_spec.rb b/spec/models/campaign_spec.rb index 64f76747..60676d8e 100644 --- a/spec/models/campaign_spec.rb +++ b/spec/models/campaign_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' RSpec.describe Campaign, type: :model do describe 'sends correct email based on type of campaign' do - let(:nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice) } let(:parent_campaign) { force_create(:campaign, name: 'Parent campaign', nonprofit: nonprofit) } let(:child_campaign) do force_create(:campaign, diff --git a/spec/models/nonprofit_spec.rb b/spec/models/nonprofit_spec.rb index 25393904..a61da1ce 100644 --- a/spec/models/nonprofit_spec.rb +++ b/spec/models/nonprofit_spec.rb @@ -6,13 +6,11 @@ require 'rails_helper' RSpec.describe Nonprofit, type: :model do describe 'with cards' do before(:each) do - @nonprofit = create(:nonprofit_with_cards) - end - before (:each) do - cards = @nonprofit.cards.to_ary - @card1 = cards.first { |i| i.name == 'card1' } - @card2 = cards.first { |i| i.name == 'card2' } - @card3 = cards.first { |i| i.name == 'card3' } + @nonprofit = create(:nm_justice) + + @card1 = create(:card, holder: @nonprofit, name: 'card1') + @card2 = create(:card, holder: @nonprofit, name: 'card2') + @card3 = create(:card, holder: @nonprofit, name: 'card3', inactive:true) end describe '.active_cards' do it 'should return all cards' do @@ -38,7 +36,7 @@ RSpec.describe Nonprofit, type: :model do end describe '.currency_symbol' do - let(:nonprofit) { force_create(:nonprofit, currency: 'eur') } + let(:nonprofit) { force_create(:nm_justice, currency: 'eur') } let(:euro) { '€' } it 'finds correct currency symbol for nonprofit' do diff --git a/spec/support/contexts/shared_donation_charge_context.rb b/spec/support/contexts/shared_donation_charge_context.rb index 0bc1dc54..c4cfeebd 100644 --- a/spec/support/contexts/shared_donation_charge_context.rb +++ b/spec/support/contexts/shared_donation_charge_context.rb @@ -4,8 +4,8 @@ require 'stripe_mock' RSpec.shared_context :shared_donation_charge_context do - let(:nonprofit) { force_create(:nonprofit, name: 'nonprofit name', slug: 'nonprofit_nameo') } - let(:other_nonprofit) { force_create(:nonprofit) } + let(:nonprofit) { force_create(:nm_justice, name: 'nonprofit name', slug: 'nonprofit_nameo') } + let(:other_nonprofit) { force_create(:fv_poverty) } let(:supporter) { force_create(:supporter, nonprofit: nonprofit, locale: 'locale_one') } let(:other_nonprofit_supporter) { force_create(:supporter, nonprofit: other_nonprofit, locale: 'locale_two') } let(:card) { force_create(:card, holder: supporter) } diff --git a/spec/support/payments_for_a_payout.rb b/spec/support/payments_for_a_payout.rb index fbeeb1ed..446c39fd 100644 --- a/spec/support/payments_for_a_payout.rb +++ b/spec/support/payments_for_a_payout.rb @@ -86,7 +86,7 @@ shared_context 'payments for a payout' do end let(:other_np_payment) do - p = create_payment(nonprofit: force_create(:nonprofit)) + p = create_payment(nonprofit: force_create(:fv_poverty)) create_charge(payment: p, amount: 2000, fee: -400, status: 'available') return p end