]> nos-oignons.net Git - gestion-adh.git/blob - features/support/env.rb
Correction des rappels d'adhésion lorsque le renouvellement a été fait avant la date...
[gestion-adh.git] / features / support / env.rb
1 require 'rubygems'
2 require 'bundler'
3 Bundler.setup
4
5 require 'timecop'
6 require 'tmpdir'
7 require 'aruba/cucumber'
8 require 'safe_yaml'
9 require 'mail'
10
11 SafeYAML::OPTIONS[:default_mode] = :safe
12
13 require 'nos_oignons'
14
15 Before do
16   ENV['GIT_COMMITTER_NAME'] = ENV['GIT_AUTHOR_NAME'] = 'J. Test'
17   ENV['GIT_COMMITTER_EMAIL'] = ENV['GIT_AUTHOR_EMAIL'] = 'test@example.org'
18   @tmpdir = Dir.mktmpdir('gestion-adh')
19   @dirs = [@tmpdir]
20   @aruba_io_wait_seconds = 0.1
21   @aruba_timeout_seconds = 20
22   @orig_wiki_path = ENV['NOS_OIGNONS_BOARD_WIKI_PATH']
23   @orig_reminder_db_path = ENV['NOS_OIGNONS_REMINDER_DB']
24   @orig_receipts_dir = ENV['NOS_OIGNONS_RECEIPTS_DIR']
25   ENV['NOS_OIGNONS_REMINDER_DB'] = File.join(current_dir, 'reminders.yaml')
26   NosOignons::ReminderDb.instance.reload!
27   ENV['NOS_OIGNONS_RECEIPTS_DIR'] = File.join(current_dir, 'receipts')
28   FileUtils.mkdir(ENV['NOS_OIGNONS_RECEIPTS_DIR'])
29   Mail.defaults do
30     delivery_method :test
31   end
32   Mail::TestMailer.deliveries.clear
33 end
34
35 After do
36   ENV['NOS_OIGNONS_REMINDER_DB'] = @orig_reminder_db_path
37   ENV['NOS_OIGNONS_BOARD_WIKI_PATH'] = @orig_wiki_path
38   ENV['NOS_OIGNONS_RECEIPTS_DIR'] = @orig_receipts_dir
39   FileUtils.remove_entry_secure @tmpdir
40 end