Upgraded Rails and RSpec
[monkeycharger.git] / spec / spec_helper.rb
blob3b354762db011273a229d27ed7e248f4e4b26858
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")
5 require 'spec'
6 require 'spec/rails'
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:
14   #   describe "...." do
15   #     fixtures :table_a, :table_b
16   #
17   # Alternatively, if you prefer to declare them only once, you can
18   # do so here, like so ...
19   #
20   #   config.global_fixtures = :table_a, :table_b
21   #
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.
24 end
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)
30    c.save
31    c
32 end