Saucy is a Rails engine for monthly subscription-style SaaS apps.
Example scenarios covered by Saucy:
- I sign up for "Free" plan under new account "thoughtbot"
- I am an admin and can be reached at "email@example.com"
- I create a project "Hoptoad"
- I upgrade to the "Basic" plan and my credit card is charged
- I now have permissions to add users and projects to the "thoughtbot" account
- I invite "firstname.lastname@example.org" to "Hoptoad"
- I create a project "Trajectory"
- I invite "email@example.com" to "Trajectory"
In your Gemfile:
gem "saucy", :git => 'firstname.lastname@example.org:thoughtbot/saucy.git'
After you bundle, run the generators:
rails generate saucy:install rails generate saucy:views
You will want to include the
before_filter in any controller actions that you want to protect if the user is using an past due paid account.
You will want to custom the from email address on billing emails:
Saucy::Configuration.mailer_sender = "email@example.com"
In addition, there are a number of strings such as application name, support url, etc. that are provided and customized with i18n translations. You can customize these in your app, and you can see what they are by looking at config/locales/en.yml in saucy.
There is a
saucy:update_subscriptions rake task which should be run on a regular basis to send receipts and payment processing problem emails.
Plans need to exist for users to sign up for. In db/seeds.rb:
%w(free expensive mega-expensive).each do |plan_name| .find_or_create_by_name(plan_name) end
Then run: rake db:seed
Generate the Braintree Fake for your specs:
rails generate saucy:specs
Generate feature coverage:
rails generate saucy:features
To use seed data in your Cucumber, add this to features/support/seed.rb:
To change the layout for a controller inside of saucy, add a line like this to your config/application.rb:
config.saucy.layouts.accounts.index = "custom"
Your layout should yield(:header) in order to get the headers from saucy views.
To extend the ProjectsController:
class < ApplicationController include :: def edit super @deleters = @project.deleters end end