#require File.expand_path('../../spec_helper', __FILE__)
require File.expand_path('../../../../../easy_extensions/test/spec/spec_helper', __FILE__)
describe Mailer < ActionMailer::Base, :logged => :admin do

  let!(:issue) { FactoryGirl.create(:issue, :with_journals).reload }
  let(:user) { FactoryGirl.create(:user) }

  #let(:sets) { EasySetting.find_by(name: "issue_mail_subject_style").value = "easy" }
  #let(:mail) { Mailer.get_mail_subject_for_issue_add(issue) }


  # before(:each) do
  #  EasySetting.find_by(name: "issue_mail_subject_style") == 'easy'
  # end

  # it 'sends emails' do
  #   with_easy_settings(:issue_mail_subject_style => 'Easy (>>> My task - [Project > Project] updated - Subject (Status))') do
  #     Mailer.issue_add(issue, User.current)
  #     mail = ActionMailer::Base.deliveries.last
  #     expect(mail.subject).to eq("jdksladj")
  #   end
  # end

  it 'sends emails' do
    with_easy_settings(:issue_mail_subject_style => "easy") do
      Mailer.issue_add(issue, User.current)
      mail = ActionMailer::Base.deliveries.last
      expect(mail.subject).to include(issue.subject)
    end
  end
end