Initial Update to ruby 4.2

This commit is contained in:
Eric Schultz 2018-11-08 18:29:00 -06:00 committed by Luis Castro
parent 6fa8bd5a62
commit ca17696529
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639
52 changed files with 559 additions and 487 deletions

11
Gemfile
View file

@ -2,7 +2,7 @@ source 'https://rubygems.org'
ruby '2.3.7'
gem 'rake'
gem 'rails', '3.2.22.5'
gem 'rails', '~> 4.1'
gem 'rails_12factor'
# https://stripe.com/docs/api
gem 'stripe'
@ -26,8 +26,7 @@ gem 'test-unit', '~> 3.0'
gem 'hamster'
gem 'aws-ses'
gem 'aws-sdk'
gem 'aws-sdk', '~> 1'
# for blocking ip addressses
gem 'rack-attack'
@ -91,7 +90,7 @@ gem 'table_print'
gem 'bunny', '>= 2.6.3'
gem 'rails-i18n', '~> 3.0.0' # For 3.x
gem 'rails-i18n', '~> 4.0' # For 3.x
gem 'i18n-js'
gem 'countries'
@ -125,7 +124,7 @@ end
# Gems used for asset compilation
gem 'sass', '3.2.19'
gem 'sass-rails', '3.2.6'
gem 'sass-rails'
gem 'uglifier'
# make logging less terrible in rails
@ -137,7 +136,7 @@ gem 'dry-validation' # used only for config validation
gem 'foreman'
gem 'grape', '~> 1.1.0'
gem 'grape-entity', git: 'https://github.com/ruby-grape/grape-entity.git', ref: '0e04aa561373b510c2486282979085eaef2ae663'
gem 'grape-entity'
gem 'grape-swagger'
gem 'grape-swagger-entity'
gem 'grape_url_validator'

View file

@ -13,9 +13,9 @@ GIT
revision: 0e04aa561373b510c2486282979085eaef2ae663
ref: 0e04aa561373b510c2486282979085eaef2ae663
specs:
grape-entity (0.7.1)
activesupport (>= 3.0.0)
multi_json (>= 1.3.2)
qx (0.1.1)
activerecord (>= 3.0)
colorize (~> 0.8)
PATH
remote: gems/grape_devise
@ -42,100 +42,108 @@ GEM
remote: https://rubygems.org/
specs:
action_mailer_matchers (1.0.0)
actionmailer (3.2.22.5)
actionpack (= 3.2.22.5)
mail (~> 2.5.4)
actionpack (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activerecord (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
activesupport (3.2.22.5)
actionmailer (4.1.16)
actionpack (= 4.1.16)
actionview (= 4.1.16)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.16)
actionview (= 4.1.16)
activesupport (= 4.1.16)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
activerecord (4.0.0)
activemodel (= 4.0.0)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.4)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.8)
amq-protocol (2.2.0)
andand (1.3.3)
arel (3.0.3)
aws-sdk (1.66.0)
aws-sdk-v1 (= 1.66.0)
aws-sdk-v1 (1.66.0)
arel (5.0.1.20140414130214)
aws-eventstream (1.0.1)
aws-partitions (1.110.0)
aws-sdk (1.67.0)
aws-sdk-v1 (= 1.67.0)
aws-sdk-core (3.37.0)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-kms (1.11.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.23.1)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sdk-v1 (1.67.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
nokogiri (~> 1)
aws-ses (0.6.0)
builder
mail (> 2.2.5)
mime-types
xml-simple
aws-sigv4 (1.0.3)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.11)
binding_of_caller (0.7.2)
bcrypt (3.1.12)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.1.7)
bootsnap (1.3.2)
msgpack (~> 1.0)
browserify-rails (0.9.3)
sprockets (~> 2.2)
builder (3.0.4)
bunny (2.7.1)
amq-protocol (>= 2.2.0)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
browserify-rails (1.1.0)
railties (>= 4.0.0, < 5.0)
builder (3.2.3)
bunny (2.12.0)
amq-protocol (~> 2.3, >= 2.3.0)
carrierwave (1.2.3)
activemodel (>= 4.0.0)
activesupport (>= 4.0.0)
mime-types (>= 1.16)
carrierwave-aws (0.5.0)
aws-sdk (~> 1.58)
carrierwave (~> 0.7)
carrierwave-aws (1.3.0)
aws-sdk-s3 (~> 1.0)
carrierwave (>= 0.7, < 2.0)
chronic (0.10.2)
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colorize (0.8.1)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.4)
config (1.7.0)
activesupport (>= 3.0)
deep_merge (~> 1.2.1)
dry-validation (>= 0.10.4)
countries (2.1.2)
countries (2.1.4)
i18n_data (~> 0.8.0)
money (~> 6.9)
sixarm_ruby_unaccent (~> 1.1)
unicode_utils (~> 1.4)
crack (0.4.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
css_parser (1.3.6)
css_parser (1.6.0)
addressable
dalli (2.7.6)
dalli (2.7.9)
dante (0.2.0)
database_cleaner (1.6.1)
database_cleaner (1.7.0)
debase (0.2.2)
debase-ruby_core_source (>= 0.10.2)
debase-ruby_core_source (0.10.3)
debug_inspector (0.0.2)
debug_inspector (0.0.3)
deep_merge (1.2.1)
delayed_job (4.1.2)
activesupport (>= 3.0, < 5.1)
delayed_job_active_record (4.1.1)
activerecord (>= 3.0, < 5.1)
delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
@ -146,65 +154,65 @@ GEM
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-async (0.9.0)
devise (~> 3.2)
diff-lcs (1.2.5)
devise-async (0.10.2)
devise (>= 3.2, < 4.0)
diff-lcs (1.3)
docile (1.3.1)
domain_name (0.5.20160615)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.0.1)
dotenv-rails (2.0.1)
dotenv (= 2.0.1)
dotenv (2.5.0)
dotenv-rails (2.5.0)
dotenv (= 2.5.0)
railties (>= 3.2, < 6.0)
dry-configurable (0.7.0)
concurrent-ruby (~> 1.0)
dry-container (0.6.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.5)
dry-core (0.4.7)
concurrent-ruby (~> 1.0)
dry-equalizer (0.2.0)
dry-equalizer (0.2.1)
dry-inflector (0.1.2)
dry-logic (0.4.2)
dry-container (~> 0.2, >= 0.2.6)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-types (0.12.2)
dry-types (0.13.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1)
dry-container (~> 0.3)
dry-core (~> 0.2, >= 0.2.1)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.2)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 0.4, >= 0.4.2)
inflecto (~> 0.0.0, >= 0.0.2)
dry-validation (0.11.1)
dry-validation (0.12.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (~> 0.2, >= 0.2.1)
dry-equalizer (~> 0.2)
dry-logic (~> 0.4, >= 0.4.0)
dry-types (~> 0.12.0)
dry-types (~> 0.13.1)
equalizer (0.0.11)
erubis (2.7.0)
execjs (2.5.2)
factory_bot (4.8.2)
execjs (2.7.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faraday (0.9.1)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.9.1)
faraday (>= 0.7.4, < 0.10)
font_assets (0.1.14)
rack
foreman (0.84.0)
foreman (0.85.0)
thor (~> 0.19.1)
fullcontact (0.9.0)
faraday (~> 0.9.0)
faraday_middleware (>= 0.9)
fullcontact (0.18.0)
faraday (~> 0.11.0)
faraday_middleware (>= 0.10)
hashie (>= 2.0, < 4.0)
plissken
geocoder (1.2.11)
get_process_mem (0.2.1)
geocoder (1.5.0)
get_process_mem (0.2.3)
grape (1.1.0)
activesupport
builder
@ -212,11 +220,14 @@ GEM
rack (>= 1.3.0)
rack-accept
virtus (>= 1.0.0)
grape-swagger (0.28.0)
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-swagger (0.31.1)
grape (>= 0.16.2)
grape-swagger-entity (0.2.3)
grape-swagger-entity (0.3.0)
grape-entity (>= 0.5.0)
grape-swagger (>= 0.20.4)
grape-swagger (>= 0.31.0)
grape_logging (1.8.0)
grape
rack
@ -224,36 +235,34 @@ GEM
grape (>= 0.12.0)
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.4.1)
heroku-deflater (0.5.3)
hashdiff (0.3.7)
hashie (3.6.0)
heroku-deflater (0.6.3)
rack (>= 1.4.5)
hike (1.2.3)
http-cookie (1.0.2)
http-cookie (1.0.3)
domain_name (~> 0.5)
httparty (0.13.3)
json (~> 1.8)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n-js (3.0.2)
i18n (~> 0.6, >= 0.6.6)
i18n-js (3.1.0)
i18n (>= 0.6.6, < 2)
i18n_data (0.8.0)
ice_nine (0.11.2)
inflecto (0.0.2)
journey (1.0.4)
jmespath (1.4.0)
json (1.8.6)
kdtree (0.3)
lograge (0.3.6)
actionpack (>= 3)
activesupport (>= 3)
railties (>= 3)
mail (2.5.5)
mime-types (~> 1.16)
treetop (~> 1.4.8)
kdtree (0.4)
lograge (0.10.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
mail_view (2.0.4)
tilt
memcachier (0.0.2)
method_source (0.9.0)
method_source (0.9.1)
mime-types (1.25.1)
mini_magick (4.9.5)
mini_portile2 (2.1.0)
@ -261,7 +270,7 @@ GEM
i18n (>= 0.6.4, < 1.0)
msgpack (1.2.0)
multi_json (1.13.1)
multi_xml (0.5.5)
multi_xml (0.6.0)
multipart-post (2.0.0)
mustermann (1.0.3)
mustermann-grape (1.0.0)
@ -271,47 +280,46 @@ GEM
kdtree
require_all
netrc (0.11.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
parallel (1.6.1)
pg (0.18.3)
plissken (0.2.0)
symbolize (~> 4.2)
parallel (1.12.1)
pg (0.21.0)
polyglot (0.3.5)
power_assert (1.1.1)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
puma (3.11.2)
public_suffix (3.0.3)
puma (3.12.0)
puma_worker_killer (0.1.0)
get_process_mem (~> 0.2)
puma (>= 2.7, < 4)
rabl (0.11.6)
rabl (0.14.0)
activesupport (>= 2.3.14)
rack (1.4.7)
rack (1.5.5)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (4.2.0)
rack
rack-cache (1.7.2)
rack (>= 0.4)
rack-ssl (1.3.4)
rack-attack (5.4.2)
rack (>= 1.0, < 3)
rack-ssl (1.4.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
rack-timeout (0.4.2)
rails (3.2.22.5)
actionmailer (= 3.2.22.5)
actionpack (= 3.2.22.5)
activerecord (= 3.2.22.5)
activeresource (= 3.2.22.5)
activesupport (= 3.2.22.5)
bundler (~> 1.0)
railties (= 3.2.22.5)
rails-i18n (3.0.1)
i18n (~> 0.5)
rails (>= 3.0.0, < 4.0.0)
rack-timeout (0.5.1)
rails (4.1.16)
actionmailer (= 4.1.16)
actionpack (= 4.1.16)
actionview (= 4.1.16)
activemodel (= 4.1.16)
activerecord (= 4.1.16)
activesupport (= 4.1.16)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.16)
sprockets-rails (~> 2.0)
rails-i18n (4.0.9)
i18n (~> 0.7)
railties (~> 4.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
@ -322,90 +330,86 @@ GEM
activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (12.3.1)
rdoc (3.12.2)
json (~> 1.4)
require_all (1.3.2)
thor (>= 0.18.1, < 2.0)
rake (12.3.2)
request_store (1.4.1)
rack (>= 1.4)
require_all (2.0.0)
responders (1.1.2)
railties (>= 3.2, < 4.2)
rest-client (1.8.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
roadie (3.0.4)
css_parser (~> 1.3.4)
nokogiri (~> 1.6.0)
roadie-rails (1.0.5)
railties (>= 3.0, < 4.3)
roadie (~> 3.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.1)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
roadie (3.4.0)
css_parser (~> 1.4)
nokogiri (~> 1.5)
roadie-rails (1.3.0)
railties (>= 3.0, < 5.3)
roadie (~> 3.1)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-rails (3.5.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
ruby-debug-ide (0.6.1)
rake (>= 0.8.1)
ruby-prof (0.15.9)
safe_yaml (1.0.4)
sass (3.2.19)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sixarm_ruby_unaccent (1.2.0)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
stripe (1.49.0)
rest-client (>= 1.4, < 3.0)
symbolize (4.5.2)
activemodel (>= 3.2, < 5)
activesupport (>= 3.2, < 5)
i18n
table_print (1.5.4)
test-unit (3.2.7)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
stripe (1.58.0)
rest-client (>= 1.4, < 4.0)
table_print (1.5.6)
test-unit (3.2.8)
power_assert
thor (0.19.4)
thread_safe (0.3.6)
tilt (1.4.1)
timecop (0.7.3)
traceroute (0.5.0)
tilt (2.0.9)
timecop (0.9.1)
traceroute (0.8.0)
rails (>= 3.0.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.54)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.19)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unf_ext (0.0.7.5)
unicode_utils (1.4.0)
virtus (1.0.5)
axiom-types (~> 0.1)
@ -414,9 +418,10 @@ GEM
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.7)
rack (>= 1.0)
webmock (1.21.0)
webmock (3.4.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
xml-simple (1.1.5)
PLATFORMS
@ -451,7 +456,7 @@ DEPENDENCIES
fullcontact
geocoder
grape (~> 1.1.0)
grape-entity!
grape-entity
grape-swagger
grape-swagger-entity
grape_devise!
@ -475,9 +480,10 @@ DEPENDENCIES
qx!
rabl
rack-attack
rack-ssl
rack-timeout
rails (= 3.2.22.5)
rails-i18n (~> 3.0.0)
rails (~> 4.1)
rails-i18n (~> 4.0)
rails_12factor
rake
roadie-rails
@ -486,7 +492,7 @@ DEPENDENCIES
ruby-debug-ide
ruby-prof (= 0.15.9)
sass (= 3.2.19)
sass-rails (= 3.2.6)
sass-rails
simplecov (~> 0.16.1)
sprockets
stripe

View file

@ -2,9 +2,9 @@
module Campaigns; class CampaignGiftOptionsController < ApplicationController
include Controllers::CampaignHelper
before_filter :authenticate_campaign_editor!, only: [:index]
before_filter :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order, :report]
def index
def report
respond_to do |format|
format.json do
render json: QueryCampaignGifts.report_metrics(current_campaign.id)
@ -12,4 +12,40 @@ module Campaigns; class CampaignGiftOptionsController < ApplicationController
end
end
def index
@gift_options = current_campaign.campaign_gift_options.order('"order", amount_recurring, amount_one_time')
render json: {data: @gift_options}
end
def show
render json: {data: current_campaign.campaign_gift_options.find(params[:id])}
end
def create
campaign = current_campaign
json_saved CreateCampaignGiftOption.create(campaign, params[:campaign_gift_option]),
'Gift option successfully created!'
end
def update
@campaign = current_campaign
gift_option = @campaign.campaign_gift_options.find params[:id]
json_saved UpdateCampaignGiftOption.update(gift_option, params[:campaign_gift_option]), 'Successfully updated'
end
# put /nonprofits/:nonprofit_id/campaigns/:campaign_id/campaign_gift_options/update_order
# Pass in {data: [{id: 1, order: 1}]}
def update_order
updated_gift_options = UpdateOrder.with_data('campaign_gift_options', params[:data])
render json: updated_gift_options
end
def destroy
@campaign = current_campaign
render_json { DeleteCampaignGiftOption.delete(@campaign, params[:id])}
end
end; end

View file

@ -57,18 +57,7 @@ class CampaignsController < ApplicationController
end
def create
Time.use_zone(current_nonprofit.timezone || 'UTC') do
params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present?
end
if !params[:campaign][:parent_campaign_id]
campaign = current_nonprofit.campaigns.create params[:campaign]
json_saved campaign, 'Campaign created! Well done.'
else
profile_id = params[:campaign][:profile_id]
Profile.find(profile_id).update_attributes params[:profile]
render json: CreatePeerToPeerCampaign.create(params[:campaign], profile_id)
end
render json: CreateCampaign.create(params, current_nonprofit)
end
def update

View file

@ -73,7 +73,8 @@ class Nonprofit < ActiveRecord::Base
has_many :email_settings
has_many :cards, as: :holder
has_one :bank_account, dependent: :destroy, conditions: "COALESCE(deleted, false) = false"
has_one :bank_account, -> { where("COALESCE(deleted, false) = false") },
dependent: :destroy
has_one :billing_subscription, dependent: :destroy
has_one :billing_plan, through: :billing_subscription
has_one :miscellaneous_np_info

3
bin/bundle Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

4
bin/rails Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

4
bin/rake Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

View file

@ -1,7 +1,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
#
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup'
require 'bootsnap/setup'

View file

@ -298,4 +298,4 @@ end
Settings.reload!
# Initialize the rails application
Commitchange::Application.initialize!
Rails.application.initialize!

View file

@ -1,5 +1,5 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.configure do
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on

View file

@ -5,7 +5,7 @@ CarrierWave.configure do |config|
config.ignore_download_errors = false
end
Commitchange::Application.configure do
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
@ -14,9 +14,8 @@ Commitchange::Application.configure do
config.cache_classes = false
config.cache_store = Settings.default.cache_store.to_sym
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
@ -26,11 +25,12 @@ Commitchange::Application.configure do
# config.action_mailer.default_url_options = { host: 'commitchange.com' }
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
config.action_mailer.smtp_settings = { address: Settings.mailer.address, port: Settings.mailer.port }
config.action_mailer.smtp_settings['user_name']= Settings.mailer.username if Settings.mailer.username
config.action_mailer.smtp_settings['password']= Settings.mailer.password if Settings.mailer.password
config.action_mailer.smtp_settings['user_name']= Settings.mailer.username if Settings.mailer.username
config.action_mailer.smtp_settings['password']= Settings.mailer.password if Settings.mailer.password
config.action_mailer.default_url_options = { host: Settings.mailer.host }
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
@ -40,9 +40,8 @@ Commitchange::Application.configure do
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works)
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Do not compress assets
config.assets.compress = false

View file

@ -1,89 +1,78 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests
config.cache_classes = true
config.cache_store = Settings.default.cache_store.to_sym
# Code is not reloaded between requests.
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Compress JavaScripts and CSS
config.assets.compress = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Generate digests for assets URLs
config.assets.digest = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Generate digests for assets URLs.
config.assets.digest = true
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# See everything in the log (default is :info)
config.log_level = :debug
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Set to :debug to see everything in the log.
config.log_level = :info
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
cdn_url= URI(Settings.cdn.url)
cdn_url = cdn_url.to_s
config.action_controller.asset_host = cdn_url
config.action_mailer.asset_host = cdn_url
config.font_assets.origin = '*'
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
config.action_mailer.default_url_options = { host: Settings.mailer.host }
# Precompile all "page" files, it needs to be set here so the proper env is setup
config.assets.precompile << Proc.new do |path|
if path =~ /.*page\.(css|js)/
puts "Compiling asset: " + path
true
else
false
end
end
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Enable threaded mode
# config.threadsafe!
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
config.assets.compile = false
config.threadsafe!
config.dependency_loading = true if $rails_rake_task
# Compress json
# config.middleware.use Rack::Deflater
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end

View file

@ -1,5 +1,5 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.configure do
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests

View file

@ -1,55 +1,42 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Show full error reports and disable caching
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
# config.action_controller.perform_caching = false
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.delivery_method = :test
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { host: 'localhost:8080' }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
config.log_level = :none
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.cache_store = :memory_store
config.threadsafe!
config.after_initialize do
ActiveRecord::Base.logger = nil
ActionController::Base.logger = nil
ActionMailer::Base.logger = nil
end
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
config.action_mailer.default_url_options = {host: 'houdiniproject.test'}
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View file

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View file

@ -0,0 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json

View file

@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View file

@ -1,4 +1,3 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections

View file

@ -1,5 +1,5 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.configure do
Rails.application.configure do
if (Rails.env != 'test')

View file

@ -1,6 +1,4 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View file

@ -5,4 +5,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Commitchange::Application.config.secret_token = ENV.fetch('SECRET_TOKEN')
Rails.application.config.secret_token = ENV.fetch('SECRET_TOKEN')

View file

@ -1,9 +1,3 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
# Be sure to restart your server when you modify this file.
Commitchange::Application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 4.hours
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Commitchange::Application.config.session_store :active_record_store
Rails.application.config.session_store :cookie_store, key: '_commitchange_session'

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
timeout = Integer(ENV['WEB_TIMEOUT'] || 15)
if ENV['RAILS_ENV'] == 'development' || ENV['IDE_PROCESS_DISPATCHER']
timeout = 10000
end
Rack::Timeout.timeout = timeout # seconds
# timeout = Integer(ENV['WEB_TIMEOUT'] || 15)
# if ENV['RAILS_ENV'] == 'development' || ENV['IDE_PROCESS_DISPATCHER']
# timeout = 10000
# end
#
# Rack::Timeout.timeout = timeout # seconds

View file

@ -1,5 +1,5 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
Commitchange::Application.routes.draw do
Rails.application.routes.draw do
mount Houdini::API => '/api'
if Rails.env == 'development'
@ -196,47 +196,47 @@ Commitchange::Application.routes.draw do
:confirmations => 'users/confirmations'
}
devise_scope :user do
match '/sign_in' => 'users/sessions#new'
match '/signup' => 'devise/registrations#new'
post '/confirm' => 'users/confirmations#confirm'
match '/users/is_confirmed' => 'users/confirmations#is_confirmed'
match '/users/exists' => 'users/confirmations#exists'
post '/users/confirm_auth', action: :confirm_auth, controller: 'users/sessions'
match '/sign_in' => 'users/sessions#new', via: [:get, :post]
match '/signup' => 'devise/registrations#new', via: [:get, :post]
post '/confirm' => 'users/confirmations#confirm', via: [:get]
match '/users/is_confirmed' => 'users/confirmations#is_confirmed', via: [:get, :post]
match '/users/exists' => 'users/confirmations#exists', via: [:get]
post '/users/confirm_auth', action: :confirm_auth, controller: 'users/sessions', via: [:get, :post]
end
# Super admin
match '/admin' => 'super_admins#index', :as => 'admin'
match '/admin/search-nonprofits' => 'super_admins#search_nonprofits'
match '/admin/search-profiles' => 'super_admins#search_profiles'
match '/admin/search-fullcontact' => 'super_admins#search_fullcontact'
match '/admin/recurring-donations-without-cards' => 'super_admins#recurring_donations_without_cards'
match '/admin/export_supporters_with_rds' => 'super_admins#export_supporters_with_rds'
match '/admin/resend_user_confirmation' => 'super_admins#resend_user_confirmation'
match '/admin' => 'super_admins#index', :as => 'admin', via: [:get, :post]
match '/admin/search-nonprofits' => 'super_admins#search_nonprofits', via: [:get, :post]
match '/admin/search-profiles' => 'super_admins#search_profiles', via: [:get, :post]
match '/admin/search-fullcontact' => 'super_admins#search_fullcontact', via: [:get, :post]
match '/admin/recurring-donations-without-cards' => 'super_admins#recurring_donations_without_cards', via: [:get, :post]
match '/admin/export_supporters_with_rds' => 'super_admins#export_supporters_with_rds', via: [:get, :post]
match '/admin/resend_user_confirmation' => 'super_admins#resend_user_confirmation', via: [:get, :post]
# Events
match '/events' => 'events#index'
match '/events/:event_slug' => 'events#show'
match '/events' => 'events#index', via: [:get]
match '/events/:event_slug' => 'events#show', via: [:get, :post]
# Nonprofits
match ':state_code/:city/:name' => 'nonprofits#show', :as => :nonprofit_location
match ':state_code/:city/:name/donate' => 'nonprofits#donate', :as => :nonprofit_donation
match ':state_code/:city/:name/button' => 'nonprofits/button#guided'
match ':state_code/:city/:name' => 'nonprofits#show', :as => :nonprofit_location, via: [:get, :post]
match ':state_code/:city/:name/donate' => 'nonprofits#donate', :as => :nonprofit_donation, via: [:get, :post]
match ':state_code/:city/:name/button' => 'nonprofits/button#guided', via: [:get, :post]
# Campaigns
match ':state_code/:city/:name/campaigns' => 'campaigns#index'
match ':state_code/:city/:name/campaigns/:campaign_slug' => 'campaigns#show', :as => :campaign_loc
match ':state_code/:city/:name/campaigns/:campaign_slug/supporters' => 'campaigns/supporters#index', :as => :campaign_loc
match '/peer-to-peer' => 'campaigns#peer_to_peer'
match ':state_code/:city/:name/campaigns' => 'campaigns#index', via: [:get, :post]
match ':state_code/:city/:name/campaigns/:campaign_slug' => 'campaigns#show', via: [:get, :post]
match ':state_code/:city/:name/campaigns/:campaign_slug/supporters' => 'campaigns/supporters#index', via: [:get, :post]
match '/peer-to-peer' => 'campaigns#peer_to_peer', via: [:get, :post]
# Events
match ':state_code/:city/:name/events' => 'events#index'
match ':state_code/:city/:name/events/:event_slug' => 'events#show'
match ':state_code/:city/:name/events/:event_slug/stats' => 'events#stats'
match ':state_code/:city/:name/events/:event_slug/tickets' => 'tickets#index'
match ':state_code/:city/:name/events' => 'events#index', via: [:get, :post]
match ':state_code/:city/:name/events/:event_slug' => 'events#show', via: [:get, :post]
match ':state_code/:city/:name/events/:event_slug/stats' => 'events#stats', via: [:get, :post]
match ':state_code/:city/:name/events/:event_slug/tickets' => 'tickets#index', via: [:get, :post]
# get '/events' => 'events#index'
# Dashboard
match ':state_code/:city/:name/dashboard' => 'nonprofits#dashboard', as: :np_dashboard
match ':state_code/:city/:name/dashboard' => 'nonprofits#dashboard', as: :np_dashboard, via: [:get, :post]
# Misc
get '/pages/wp-plugin', to: redirect('/help/wordpress-plugin') #temporary, until WP plugin updated
@ -248,7 +248,7 @@ Commitchange::Application.routes.draw do
get '/maps/specific-npo-supporters' => 'maps#specific_npo_supporters'
# Mailchimp Landing
match '/mailchimp-landing' => 'nonprofits/nonprofit_keys#mailchimp_landing'
match '/mailchimp-landing' => 'nonprofits/nonprofit_keys#mailchimp_landing', via: [:get, :post]
# Webhooks
post '/webhooks/stripe_subscription_payment' => 'webhooks#subscription_payment'

22
config/secrets.yml Normal file
View file

@ -0,0 +1,22 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 2d40128da31b5d45c2db72181b23eb1d2ca216517e033921a07febee5350179627b4ea75f898b71e2641df86ceed0e45a8a052731a1ce8420fe07d0f3840688d
test:
secret_key_base: e0cdefb8725ea588ef3d2786bbfe5b79c2394f9c2203662c246a5fbdf20aeb3ecf4ae81f27d276139c661ad7091fc0060621edba2837d55b0fe7726a2de359c6
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

View file

@ -3,7 +3,7 @@
--
-- Dumped from database version 9.6.5
-- Dumped by pg_dump version 9.6.11
-- Dumped by pg_dump version 9.6.10
SET statement_timeout = 0;
SET lock_timeout = 0;

View file

@ -2,4 +2,32 @@
module CreateCampaign
CAMPAIGN_NAME_LENGTH_LIMIT = 60
# @return [Object] a json object for historical purposes
def self.create(params, nonprofit)
Time.use_zone(nonprofit.timezone || 'UTC') do
params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present?
end
if !params[:campaign][:parent_campaign_id]
campaign = nonprofit.campaigns.create params[:campaign]
#do notifications
user = campaign.profile.user
Role.create(name: :campaign_editor, user_id: user.id, host: self)
CampaignMailer.delay.creation_followup(self)
NonprofitAdminMailer.delay.supporter_fundraiser(self) unless QueryRoles.is_nonprofit_user?(user.id, self.nonprofit_id)
return { errors: campaign.errors.messages }.as_json unless campaign.errors.empty?
return campaign.as_json
#json_saved campaign, 'Campaign created! Well done.'
else
profile_id = params[:campaign][:profile_id]
Profile.find(profile_id).update_attributes params[:profile]
return CreatePeerToPeerCampaign.create(params[:campaign], profile_id)
end
end
end

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
module Email
Regex ||= /^[^ ]+@[^ ]+\.[^ ]+/i
Regex ||= /\A[^ ]+@[^ ]+\.[^ ]+/i
#PsqlRegex ||= '^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]+$'
end

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe Houdini::V1::<%= name.camelcase %>, :type => :request do
describe :get do
describe 'get', :get do
end
end

View file

@ -1,18 +1,18 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
require 'rails_helper'
describe Houdini::V1::Nonprofit, :type => :controller do
describe :get do
describe Houdini::V1::Nonprofit, :type => :request do
describe 'get' do
end
describe :post do
around {|e|
describe 'post' do
around(:each) do |example|
@old_bp =Settings.default_bp
e.run
example.run
Settings.default_bp = @old_bp
}
end
def expect_validation_errors(actual, input)
expected_errors = input.with_indifferent_access[:errors]
expect(actual["errors"]).to match_array expected_errors
@ -47,7 +47,7 @@ describe Houdini::V1::Nonprofit, :type => :controller do
}.with_indifferent_access
}
describe 'authorization' do
around {|e|
around(:each) {|e|
Rails.configuration.action_controller.allow_forgery_protection = true
e.run
Rails.configuration.action_controller.allow_forgery_protection = false

View file

@ -11,14 +11,14 @@ describe CampaignGiftOptionsController, :type => :controller do
end
describe 'update' do
include_context :open_to_campaign_editor, :put, :update, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_campaign_editor, :put, :update, nonprofit_id: :__our_np, campaign_id: :__our_campaign, id: "1"
end
describe 'destroy' do
include_context :open_to_campaign_editor, :delete, :destroy, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_campaign_editor, :delete, :destroy, nonprofit_id: :__our_np, campaign_id: :__our_campaign, id: "1"
end
describe 'update_order' do
include_context :open_to_campaign_editor, :put, :update_order, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_campaign_editor, :put, :update_order, nonprofit_id: :__our_np, campaign_id: :__our_campaign, id: "1"
end
end
@ -28,7 +28,7 @@ describe CampaignGiftOptionsController, :type => :controller do
end
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, campaign_id: :__our_campaign, id: "1"
end
end
end

View file

@ -15,15 +15,15 @@ describe CampaignsController, :type => :controller do
end
describe 'duplicate' do
include_context :open_to_confirmed_users, :post, :duplicate, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_confirmed_users, :post, :duplicate, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'update' do
include_context :open_to_campaign_editor, :put, :update, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_campaign_editor, :put, :update, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'soft_delete' do
include_context :open_to_campaign_editor, :delete, :soft_delete, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_campaign_editor, :delete, :soft_delete, nonprofit_id: :__our_np, id: :__our_campaign
end
end
@ -33,33 +33,34 @@ describe CampaignsController, :type => :controller do
end
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'activities' do
include_context :open_to_all, :get, :activities, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :activities, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'metrics' do
include_context :open_to_all, :get, :metrics, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :metrics, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'timeline' do
include_context :open_to_all, :get, :timeline, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :timeline, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'totals' do
include_context :open_to_all, :get, :totals, nonprofit_id: :__our_np, campaign_id: :__our_campaign
include_context :open_to_all, :get, :totals, nonprofit_id: :__our_np, id: :__our_campaign
end
describe 'peer_to_peer' do
include_context :open_to_all, :get, :peer_to_peer, nonprofit_id: :__our_np
end
end
end
describe 'routes' do
it "routes campaigns#index" do
expect(:get => "/nonprofits/5/campaigns/4").to(route_to(:controller => "campaigns", :action => "show", nonprofit_id: "5", id: "4"))
end
end
end

View file

@ -11,11 +11,11 @@ describe EventDiscountsController, :type => :controller do
end
describe 'update' do
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, event_id: :__our_event, id: '2'
end
describe 'destroy' do
include_context :open_to_event_editor, :delete, :destroy, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :delete, :destroy, nonprofit_id: :__our_np, event_id: :__our_event, id: '2'
end
@ -23,7 +23,7 @@ describe EventDiscountsController, :type => :controller do
describe 'open to all' do
describe 'index' do
include_context :open_to_all, :get, :index, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_all, :get, :index, nonprofit_id: :__our_np, event_id: :__our_event, id: "2"
end
end
end

View file

@ -6,19 +6,19 @@ describe EventsController, :type => :controller do
describe 'authorization' do
include_context :shared_user_context
describe 'create' do
include_context :open_to_event_editor, :post, :create, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :post, :create, nonprofit_id: :__our_np, id: :__our_event
end
describe 'update' do
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, id: :__our_event
end
describe 'duplicate' do
include_context :open_to_event_editor, :post, :duplicate, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :post, :duplicate, nonprofit_id: :__our_np, id: :__our_event
end
describe 'soft_delete' do
include_context :open_to_event_editor, :delete, :soft_delete, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :delete, :soft_delete, nonprofit_id: :__our_np, id: :__our_event
end
describe 'stats' do
include_context :open_to_event_editor, :get, :stats, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :get, :stats, nonprofit_id: :__our_np, id: :__our_event
end
describe 'name_and_id' do
@ -36,14 +36,14 @@ describe EventsController, :type => :controller do
end
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_event
end
describe 'activities' do
include_context :open_to_all, :get, :activities, nonprofit_id: :__our_np
include_context :open_to_all, :get, :activities, nonprofit_id: :__our_np, id: :__our_event
end
describe 'metrics' do
include_context :open_to_all, :get, :metrics, nonprofit_id: :__our_np
include_context :open_to_all, :get, :metrics, nonprofit_id: :__our_np, id: :__our_event
end

View file

@ -7,7 +7,7 @@ describe Nonprofits::ActivitiesController, :type => :controller do
include_context :shared_user_context
describe 'rejects unauthorized users' do
describe 'get' do
include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :index, id: :__our_np
end
end
end

View file

@ -14,7 +14,7 @@ describe Nonprofits::CustomFieldMastersController, :type => :controller do
end
describe 'destroy' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end
end
end

View file

@ -10,11 +10,11 @@ describe Nonprofits::CustomFieldJoinsController, :type => :controller do
end
describe 'modify' do
include_context :open_to_np_associate, :post, :modify, nonprofit_id: :__our_np
include_context :open_to_np_associate, :post, :modify, nonprofit_id: :__our_np, id: "1"
end
describe 'destroy' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: "1"
end
end
end

View file

@ -9,14 +9,14 @@ describe Nonprofits::DonationsController, :type => :controller do
describe 'rejects unauthenticated users' do
describe 'index' do
include_context :shared_user_context
include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, id: "1"
end
describe 'update' do
include_context :shared_user_context
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np, id: "1"
end
@ -27,7 +27,7 @@ describe Nonprofits::DonationsController, :type => :controller do
end
describe 'follow up' do
include_context :open_to_all, :put, :followup, nonprofit_id: :__our_np
include_context :open_to_all, :put, :followup, nonprofit_id: :__our_np, id: "1"
end
end
end

View file

@ -14,15 +14,15 @@ describe Nonprofits::PaymentsController, :type => :controller do
end
describe 'show payments' do
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
end
describe 'update' do
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np, id: '1'
end
describe 'destroy payment' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end
end
end

View file

@ -14,7 +14,7 @@ describe Nonprofits::PayoutsController, :type => :controller do
end
describe 'show' do
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
end

View file

@ -14,15 +14,15 @@ describe Nonprofits::RecurringDonationsController, :type => :controller do
end
describe 'show' do
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
end
describe 'destroy' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end
describe 'update' do
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np, id: '1'
end

View file

@ -14,23 +14,23 @@ describe Nonprofits::SupportersController, :type => :controller do
end
describe 'show' do
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
end
describe 'email_address' do
include_context :open_to_np_associate, :get, :email_address, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :email_address, nonprofit_id: :__our_np, id: '1'
end
describe 'full_contact' do
include_context :open_to_np_associate, :get, :full_contact, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :full_contact, nonprofit_id: :__our_np, id: '1'
end
describe 'info_card' do
include_context :open_to_np_associate, :get, :info_card, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :info_card, nonprofit_id: :__our_np, id: '1'
end
describe 'update' do
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np, id: '1'
end
describe 'bulk_delete' do

View file

@ -10,11 +10,11 @@ describe Nonprofits::TagJoinsController, :type => :controller do
end
describe 'modify' do
include_context :open_to_np_associate, :post, :modify, nonprofit_id: :__our_np
include_context :open_to_np_associate, :post, :modify, nonprofit_id: :__our_np, id: '1'
end
describe 'destroy' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end

View file

@ -15,7 +15,7 @@ describe Nonprofits::TagMastersController, :type => :controller do
end
describe 'destroy' do
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_associate, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end
end
end

View file

@ -7,54 +7,47 @@ describe NonprofitsController, :type => :controller do
include_context :shared_user_context
describe 'rejects unauthorized users' do
describe 'update' do
include_context :open_to_np_associate, :put, :update, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :update, id: :__our_np
end
describe 'dashboard' do
include_context :open_to_np_associate, :get, :dashboard, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :dashboard, id: :__our_np
end
describe 'dashboard_metrics' do
include_context :open_to_np_associate, :get, :dashboard_metrics, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :dashboard_metrics, id: :__our_np
end
describe 'verify_identity' do
include_context :open_to_np_associate, :put, :verify_identity, nonprofit_id: :__our_np
include_context :open_to_np_associate, :put, :verify_identity, id: :__our_np
end
describe 'recurring_donation_stats' do
include_context :open_to_np_associate, :get, :recurring_donation_stats, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :recurring_donation_stats, id: :__our_np
end
describe 'profile_todos' do
include_context :open_to_np_associate, :get, :profile_todos, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :profile_todos, id: :__our_np
end
describe 'dashboard_todos' do
include_context :open_to_np_associate, :get, :dashboard_todos, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :dashboard_todos, id: :__our_np
end
describe 'payment_history' do
include_context :open_to_np_associate, :get, :payment_history, nonprofit_id: :__our_np
include_context :open_to_np_associate, :get, :payment_history, id: :__our_np
end
describe 'destroy' do
include_context :open_to_super_admin, :delete, :destroy
include_context :open_to_super_admin, :delete, :destroy, id: :__our_np
end
end
describe 'open to all' do
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np
include_context :open_to_all, :get, :show, id: :__our_np
end
describe 'create' do
@ -62,19 +55,19 @@ describe NonprofitsController, :type => :controller do
end
describe 'btn' do
include_context :open_to_all, :get, :btn, nonprofit_id: :__our_np
include_context :open_to_all, :get, :btn, id: :__our_np
end
describe 'supporter_form' do
include_context :open_to_all, :get, :supporter_form, nonprofit_id: :__our_np
include_context :open_to_all, :get, :supporter_form, id: :__our_np
end
describe 'custom_supporter' do
include_context :open_to_all, :post, :custom_supporter, nonprofit_id: :__our_np
include_context :open_to_all, :post, :custom_supporter, id: :__our_np
end
describe 'donate' do
include_context :open_to_all, :get, :donate, nonprofit_id: :__our_np
include_context :open_to_all, :get, :donate, id: :__our_np
end
describe 'search' do

View file

@ -21,7 +21,7 @@ describe ProfilesController, :type => :controller do
describe 'open to all' do
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np
include_context :open_to_all, :get, :show, id: :__our_np
end
end
end

View file

@ -7,22 +7,20 @@ describe RecurringDonationsController, :type => :controller do
include_context :shared_user_context
describe 'open to all (note: edit token is checked inside methods)' do
describe 'edit' do
include_context :open_to_all, :get, :edit, nonprofit_id: :__our_np
include_context :open_to_all, :get, :edit, nonprofit_id: :__our_np, id: '1'
end
describe 'destroy' do
include_context :open_to_all, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_all, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end
describe 'update' do
include_context :open_to_all, :put, :update, nonprofit_id: :__our_np
include_context :open_to_all, :put, :update, nonprofit_id: :__our_np, id: '1'
end
describe 'update_amount' do
include_context :open_to_all, :put, :update_amount, nonprofit_id: :__our_np
include_context :open_to_all, :put, :update_amount, nonprofit_id: :__our_np, id: '1'
end
end
end
end

View file

@ -11,7 +11,7 @@ describe RolesController, :type => :controller do
end
describe 'destroy' do
include_context :open_to_np_admin, :delete, :destroy, nonprofit_id: :__our_np
include_context :open_to_np_admin, :delete, :destroy, nonprofit_id: :__our_np, id: '1'
end

View file

@ -7,27 +7,27 @@ describe TicketLevelsController, :type => :controller do
include_context :shared_user_context
describe 'rejects unauthorized users' do
describe 'create' do
include_context :open_to_event_editor, :post, :create, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :post, :create, nonprofit_id: :__our_np, event_id: :__our_event, id: "1"
end
describe 'update' do
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :put, :update, nonprofit_id: :__our_np, event_id: :__our_event, id: "1"
end
describe 'update_order' do
include_context :open_to_event_editor, :put, :update_order, nonprofit_id: :__our_np, event_id: :__our_event
end
describe 'destroy' do
include_context :open_to_event_editor, :delete, :destroy, nonprofit_id: :__our_np, event_id: :__our_event
include_context :open_to_event_editor, :delete, :destroy, nonprofit_id: :__our_np, event_id: :__our_event, id: "1"
end
end
describe 'open to all' do
describe 'show' do
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np
include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, event_id: :__our_event, id: '2'
end
describe 'index' do
include_context :open_to_all, :get, :index, nonprofit_id: :__our_np
include_context :open_to_all, :get, :index, nonprofit_id: :__our_np, event_id: :__our_event
end
end
end

View file

@ -0,0 +1,8 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
require 'rails_helper'
describe CreateCampaign do
it 'is untested' do
pending 'add tests here'
end
end

View file

@ -3,7 +3,7 @@ require 'rails_helper'
describe QueryDonations do
describe :campaign_export do
describe 'campaign_export' do
let(:nonprofit) {force_create(:nonprofit)}
let(:supporter) {force_create(:supporter)}