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")
7 Spec::Runner.configure do |config|
8 config.use_transactional_fixtures = true
9 config.use_instantiated_fixtures = false
10 config.fixture_path = RAILS_ROOT + '/spec/fixtures'
11 config.before(:each, :behaviour_type => :controller) do
12 raise_controller_errors
15 # You can declare fixtures for each behaviour like this:
17 # fixtures :table_a, :table_b
19 # Alternatively, if you prefer to declare them only once, you can
20 # do so here, like so ...
22 # config.global_fixtures = :table_a, :table_b
24 # If you declare global fixtures, be aware that they will be declared
25 # for all of your examples, even those that don't use them.
29 def generate_credit_card options={}
30 c = CreditCard.new({:passphrase => '12345', :number => "4111111111111111", :month => Time.now.month, :year => Time.now.year, :name => "Joe Van Dyk", :verification_value => 123, :street_address => '123 Main', :city => 'Albany', :state => 'OR', :zip => 12345, :country => 'U.S'}.merge(options))
31 c.card_type = CreditCard::type?(c.number)