Skip to content

Instantly share code, notes, and snippets.

@jgaskins
Created August 22, 2011 02:11
Show Gist options
  • Save jgaskins/1161510 to your computer and use it in GitHub Desktop.
Save jgaskins/1161510 to your computer and use it in GitHub Desktop.
Checking for private beta in a Rails app
# Normal app setup
module AppName
class Application < Rails::Application
# Other stuff unnecessary to this
# Here's the money-maker
config.release_status = ENV['RELEASE_STATUS'].to_sym || :beta
end
end
$ cucumber —-tags @private_beta
AppName::Application.routes.draw do
if AppName::Application.config.release_status == :beta
match '/signup', :to => 'home#private_beta', :as => 'signup'
else
match '/signup', :to => 'users#new', :as => 'signup'
end
end
When /^I sign up on the site$/ do
if AppName::Application.config.release_status == :beta
User.create! # or Factory :user or however you want to create them
else
visit signup_path
# Do normal sign-up stuff
end
end
Feature: User signs up
@private_beta
Scenario: User is in the private beta
Given a user's name is on the private beta list
When the user visits the site
Then he should be able to sign in
@public_release
Scenario: User signs up on the site
# Do your normal thing here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment