キュウリで働くために仕事が遅れる必要がある機能をテストしたい。私は次のステップを定義しました:キュウリと遅延ジョブに基づいて機能のテスト統合を行うには?
Given /^jobs are being dispatched$/ do
Delayed::Worker.new.work_off
end
今、私は電子メール通知をテストしようとしています。だから私は、次のシナリオを持っている:
Scenario: Receiving email when signing up
Given I am on the signup page
And I fill in "user[email]" with "[email protected]"
And I fill in "user[password]" with "password"
And I fill in "user[password_confirmation]" with "password"
And I press "Sign up"
Then I should be on the homepage
Given jobs are being dispatched
Then "[email protected]" should receive 1 emails
は受け取るべきであるn個の電子メールステップはemail_specによって定義され、次のように定義されますので、テストは、私は0のメールを受け付けておりますことを私に言って失敗した
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
unread_emails_for(address).size.should == parse_email_count(amount)
end
(このテストでは[email protected]は実際の電子メールに置き換えられ、何も受信していません)。私は、労働者が本当に始まったとは思わない。私は何を確認すべきですか?ところで、私が開発モードでテストすると、本当にそのメールが届きます。私はSQLite3のを取得していますように:: BusyExceptionに見えます
:
おかげ
編集を
するSQLite3 :: BusyException:データベースがロックされている:INSERT INTO「delayed_jobs "....
今すぐなぜ、どのように私はそれを取り除くことができますstigate!何か案が? (私のデータベースをPostgreSQLまたはmySQLに移動する以外に)。
編集: [OK]を、私は、SQLiteのからのPostgreSQLへ移動レコードがDelayed::Job
に挿入されているが、電子メールのテストが失敗します。
config.action_mailer.delivery_method = :test
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.com",
:user_name => "[email protected]",
:password => "mypassword",
:authentication => "plain",
:enable_starttls_auto => true
}
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.actionに設定されているconfig.action_mailer.delivery_methodとは何ですか? delayed_jobsテーブルにレコードが挿入されていますか? –
@Andy - SQLite3 :: BusyExceptionのためにレコードが挿入されていないようです。 –
OKレコードはdelayed_jobテーブルに挿入されていますが、テストはまだ完了していません。 config/environments/test.rbファイルの内容を追加しました。 –