This app allows you to create landing pages to capture lead (collect name and email) in exchange of some bribery (ebook, video, etc+) Emails will be added to your chosen mailchimp list.
- Use VCR for mailchimp specs
- Fix user model and Clearance
- Admin notification on new lead
- Admin dashboard to view leads
bundle install
bundle exec rake db:migrate && bundle exec annotate && bundle exec rake db:test:clone
- Define environment variables in
application.yml
inconfig
(this app uses figaro gem to manage environment variables) bundle exec rails s
Environment Variables to define
- ADMIN_EMAIL email address you want your transactional emails to be sent from
- SECRET_TOKEN a random 128 character long string for your app
- MAILCHIMP_KEY your mailchimp api key
- MAILCHIMP_LIST_ID the mailchimp list you want leads to subscribed to
ADMIN_EMAIL: "josh@example.com"
SECRET_TOKEN: "ae6f4909a3d4725ab716fe1b56jab895f43bd47558f6d0baa6db52eedc266b01555057c740kb76cd03cec46a4y70ffdcaa355dd9c1fbe993e2c2114f678ecc20"
Just run bundle exec rspec spec
Run with zeus
zeus start
zeus rspec spec
Time the difference!
zeus rspec spec
vs bundle exec rspec spec
- Create a Guardfile see below
- Start zeus:
zeus start
- Just run
bundle exec guard
I've included growl and guard for auto testing. To use growl, please make sure your Mac has growl installed.
You should also set up Guardfile
based on your system set up
This is a sample of my Guardfile that uses growl as notification. This Guardfile is modified to suit the test suit I use
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
notification :growl
guard :rspec do
watch('spec/spec_helper.rb') { "spec" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb"] }
end
- Ruby 2.1.0
- Rails 4.0.4
- Postgresql
- When running test suite, new subscribers will be added to mailchimp, to clean mailchimp list occassionally run
RAILS_ENV=test be rake mailchimp_list:wipe
- Consider stubbing out invocation of Lead#add_to_mailchimp method except for unit test (currently using VCR to speed up test without making actual API calls). The current 4 specs that uses that method: (1) Lead sign up, (2) LeadsController POST #create with valid attributes saves the new lead in the database, (3) LeadsController POST #create with valid attributes redirects to lead#show, (4) LeadsController POST #create with valid attributes emails the lead