Created
March 18, 2011 00:29
-
-
Save gmgent/875415 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require 'test_help' | |
class ActiveSupport::TestCase | |
self.use_transactional_fixtures = true | |
self.use_instantiated_fixtures = false | |
fixtures :all | |
# Add more helper methods to be used by all tests here... | |
def new_test_user(args={}) | |
i = rand(9999) | |
random_string = (Time.now.strftime("%s").to_i-i) | |
final_params = {:password => "testp", | |
:login => random_string, | |
:password_confirmation => "testp", | |
:email => "#{random_string}@gmg-entertainment.com"}.merge!(args) | |
User.create!(final_params) | |
end | |
def fake_sale(args={}) | |
Sale.create!(args) | |
end | |
def new_test_account(args={}) | |
i = rand(9999) | |
random_string = (Time.now.strftime("%s").to_i-i) | |
partner = new_test_partner | |
activator = new_test_activator | |
final_params = {:password => "password", | |
:username => random_string, | |
:partner => partner, | |
:activator => activator}.merge!(args) | |
Account.create!(final_params) | |
end | |
def new_test_partner | |
Partner.create!(:name => "Some Partner") | |
end | |
def new_test_activator | |
Activator.create!(:name => "Some Activator") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment