1 # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2 # from the project root directory.
3 ENV["RAILS_ENV"] = "test"
4 require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
8 Spec::Runner.configure do |config|
9 config.use_transactional_fixtures = true
10 config.use_instantiated_fixtures = false
11 config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
13 # You can declare fixtures for each behaviour like this:
15 # fixtures :table_a, :table_b
17 # Alternatively, if you prefer to declare them only once, you can
18 # do so here, like so ...
20 # config.global_fixtures = :table_a, :table_b
22 # If you declare global fixtures, be aware that they will be declared
23 # for all of your examples, even those that don't use them.
26 DEFAULT_TEST_PASS = '12345'
27 def generate_credit_card options={}
28 c = CreditCard.new({:passphrase => DEFAULT_TEST_PASS, :number => "4111111111111111", :month => Time.now.month, :year => Time.now.year, :name => "Joe Van Dyk", :street_address => '123 Main', :city => 'Albany', :state => 'OR', :zip => 12345, :country => 'U.S'}.merge(options))
29 c.card_type = CreditCard::type?(c.number)