I have reached this point in testing using email-spec: The code:
# Format and email the results. if fx_hash_array send_to = 'em...@example.com' MailerPublic.deliver_forex_daily_notice!(send_to,fx_hash_array) ActionMailer::Base.deliveries.each { |m| puts m } unless Rails.env.production? end The Feature Scenario: Scenario: E-Mail Exchange Rates to notify parties Given a currency exchange feed from the Bank of Canada And an empty email queue When the currency exchange retrieval script runs Then I should receive an email The Steps: Then /currency exchange retrieval script runs/ do stdout = %x(#{RAILS_ROOT}/bin/hll_forex_ca_feed.rb #...@xchg_source}) puts stdout puts current_email_address end ... local_email_steps Then /should receive (an|\d+) e-?mails?/ do |amount| amount = 1 if amount == "an" unread_emails_for(current_email_address).size.should == amount.to_i end The output: Scenario: E-Mail Exchange Rates to notify parties # features/app/models/currency_exchange_rates/ currency_exchange_rates.feature:19 xml source is: /home/byrnejb/Software/Development/Projects/proforma.git/doc/data/fx-noon-all-2009-04-15.xml Given a currency exchange feed from the Bank of Canada # features/app/models/currency_exchange_rates/step_definitions/ currency_exchange_rates_steps.rb:5 And an empty email queue # features/step_definitions/local_email_steps.rb:28 From: forexserv...@harte-lyne.ca Reply-To: supp...@harte-lyne.ca To: em...@example.com Subject: [ForEx] 2009-04-28 - Foreign Exchange Rates Notice Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=mimepart_49f713ebd7061_2d4d155c1a4737c82cd --mimepart_49f713ebd7061_2d4d155c1a4737c82cd Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline Canada Customs foreign currency exchange rates for 2009-04-28: --mimepart_49f713ebd7061_2d4d155c1a4737c82cd-- em...@example.com When the currency exchange retrieval script runs # features/app/models/currency_exchange_rates/step_definitions/ currency_exchange_rates_steps.rb:11 Then I should receive an email # features/step_definitions/local_email_steps.rb:49 expected: 1, got: 0 (using ==) Diff: @@ -1,2 +1,2 @@ -1 +0 (Spec::Expectations::ExpectationNotMetError) ./features/step_definitions/local_email_steps.rb:51:in `/should receive (an|\d+) e-?mails?/' features/app/models/currency_exchange_rates/currency_exchange_rates.feature:23:in `Then I should receive an email' The email To: header value and the current_email_address are the same insofar as I can tell. But the email_spec matcher is not finding that address in the deliveries array. Any ideas as to what I am missing? -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users