diff --git a/spec/lib/query/query_supporters_spec.rb b/spec/lib/query/query_supporters_spec.rb index bc246171..b08c905b 100644 --- a/spec/lib/query/query_supporters_spec.rb +++ b/spec/lib/query/query_supporters_spec.rb @@ -2,25 +2,28 @@ require 'rails_helper' describe QuerySupporters do - GIFT_LEVEL_ONE_TIME = 1111 - GIFT_LEVEL_RECURRING = 5585 - GIFT_LEVEL_CHANGED_RECURRING = 5512 - CAMPAIGN_GIFT_OPTION_NAME = "theowthoinv" + + let(:gift_level_one_time) { 1111 } + let(:gift_level_recurring) { 5585 } + let(:gift_level_changed_recurring) {5512 } + let(:campaign_gift_option_name) { "theowthoinv" } + + let(:np) { force_create(:nonprofit)} let(:supporter1) { force_create(:supporter, nonprofit: np)} let(:supporter2) { force_create(:supporter, nonprofit: np)} let(:campaign) { force_create(:campaign, nonprofit: np, slug: "slug stuff")} - let(:campaign_gift_option) { force_create(:campaign_gift_option, campaign: campaign, name: CAMPAIGN_GIFT_OPTION_NAME, amount_one_time: GIFT_LEVEL_ONE_TIME, amount_recurring: GIFT_LEVEL_RECURRING)} + let(:campaign_gift_option) { force_create(:campaign_gift_option, campaign: campaign, name: campaign_gift_option_name, amount_one_time: gift_level_one_time, amount_recurring: gift_level_recurring)} let(:campaign_gift1) { force_create(:campaign_gift, campaign_gift_option: campaign_gift_option, donation: donation1)} - let(:donation1) { force_create(:donation, amount: GIFT_LEVEL_ONE_TIME, campaign: campaign, supporter:supporter1)} + let(:donation1) { force_create(:donation, amount: gift_level_one_time, campaign: campaign, supporter:supporter1)} - let(:payment1) {force_create(:payment, gross_amount: GIFT_LEVEL_ONE_TIME, donation: donation1)} + let(:payment1) {force_create(:payment, gross_amount: gift_level_one_time, donation: donation1)} - let(:donation2) {force_create(:donation, amount: GIFT_LEVEL_CHANGED_RECURRING, campaign: campaign, supporter:supporter2)} - let(:payment2) {force_create(:payment, gross_amount: GIFT_LEVEL_RECURRING, donation: donation2)} - let(:payment3) {force_create(:payment, gross_amount: GIFT_LEVEL_CHANGED_RECURRING, donation: donation2)} + let(:donation2) {force_create(:donation, amount: gift_level_changed_recurring, campaign: campaign, supporter:supporter2)} + let(:payment2) {force_create(:payment, gross_amount: gift_level_recurring, donation: donation2)} + let(:payment3) {force_create(:payment, gross_amount: gift_level_changed_recurring, donation: donation2)} let(:campaign_gift2) { force_create(:campaign_gift, campaign_gift_option: campaign_gift_option, donation: donation2)} - let(:recurring) {force_create(:recurring_donation, donation: donation2, amount: GIFT_LEVEL_CHANGED_RECURRING)} + let(:recurring) {force_create(:recurring_donation, donation: donation2, amount: gift_level_changed_recurring)} let(:note_content_1) do "CONTENT1" @@ -70,7 +73,7 @@ describe QuerySupporters do data = glm[:data] - expect(data.map{|i| i['total_raised']}).to match_array([GIFT_LEVEL_ONE_TIME, GIFT_LEVEL_RECURRING]) + expect(data.map{|i| i['total_raised']}).to match_array([gift_level_one_time, gift_level_recurring]) end