Created
August 22, 2011 02:11
-
-
Save jgaskins/1161510 to your computer and use it in GitHub Desktop.
Checking for private beta in a Rails app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cucumber —-tags @private_beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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