6 @mock_mailman_db = "#{current_dir}/mock_mailman.json"
7 init_mailman_mock_db({})
8 ENV['MOCK_MAILMAN_DB'] = @mock_mailman_db
9 @orig_path = ENV['PATH']
10 ENV['PATH'] = "#{File.expand_path('../../support/mock_mailman', __FILE__)}:#{@orig_path}"
14 ENV['PATH'] = @orig_path
15 FileUtils.remove_entry_secure @mock_mailman_db
18 def init_mailman_mock_db(dict)
19 File.open(@mock_mailman_db, 'w') { |f| f.write(JSON.dump(dict)) }
23 JSON.load(File.open(@mock_mailman_db))
26 Given /^une liste ag@ avec comme emails inscrits:$/ do |subscriber_list|
27 emails = subscriber_list.strip.split
28 init_mailman_mock_db('ag' => emails)
31 Then /^la liste ag@ doit avoir comme emails inscrits:$/ do |expected|
32 emails = expected.strip.split.sort
33 expect(mailman_mock_db['ag'].sort).to eql(emails)