rename cvv to verification value
[monkeycharger.git] / trunk / spec / spec_helper.rb
blobf4bef8ab0adb8dd560da5fcc0949f2ecc0422b6f
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/rails'
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
13   end
15   # You can declare fixtures for each behaviour like this:
16   #   describe "...." do
17   #     fixtures :table_a, :table_b
18   #
19   # Alternatively, if you prefer to declare them only once, you can
20   # do so here, like so ...
21   #
22   #   config.global_fixtures = :table_a, :table_b
23   #
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.
26 end
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)
32    c.save
33    c
34 end