我刚刚在Bloc完成了我的红宝石基础课程,我开始把头埋进轨道开发中.事情进展顺利,直到我用设计和确认电子邮件打到这个障碍.我试着谷歌搜索并环顾其他一些问题,但实际上找不到任何给我任何东西,我可以拉出来并适用于我的情况.
我在注册帐户时收到以下错误.
在#976行附近从源中提取错误
def check_auth_response(res)
unless res.success?
raise SMTPAuthenticationError, res.message
end
end
Run Code Online (Sandbox Code Playgroud)
从其他帖子我知道你可能想看到我有一个如下所示的config/initializers/setup_mail.rb文件:
if Rails.env.development?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: 'smtp.sendgrid.net',
port: '587',
authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'heroku.com',
enable_starttls_auto: true
}
end
Run Code Online (Sandbox Code Playgroud)
这是一个application.yml文件示例:
SENDGRID_PASSWORD:
SENDGRID_USERNAME:
SECRET_KEY_BASE:
Run Code Online (Sandbox Code Playgroud)
在任何人建议之前,我的config/environments/development.rb中还有以下内容:
config.action_mailer.default_url_options = { host: 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
# Override Action Mailer's 'silent errors' in development
config.action_mailer.raise_delivery_errors = true
Run Code Online (Sandbox Code Playgroud)
如果你想看到任何其他文件让我知道,我会将它们添加到这篇文章中.
返回获取更多有关Bloc课程的帮助.决定带给你们一些我正在使用Monkey Patching the Array Class的问题.这个任务有8个规格 可以满足,我现在卡在一个左边,我不知道该怎么办.
我只会给你RSpecs和我遇到麻烦的部分的书面要求,因为其他一切似乎都在传递.此外,我将包括他们开始给我的启动脚手架,因此代码中没有混淆或无用的添加.
以下是Array Class Monkey Patch的书面要求:
编写一个new_map在Array类的实例上调用的新方法.它应该使用它作为implicit(self)参数调用的数组,但在其他方面表现相同.(未完成)
写一个new_select!行为与select类似的方法,但会改变调用它的数组.它可以使用Ruby的内置集合选择方法.(完整)
以下是有关Array类需要满足的RSpec:
注意:"返回具有更新值的数组"是唯一未传递的规范.
describe Array do
describe '#new_map' do
it "returns an array with updated values" do
array = [1,2,3,4]
expect( array.new_map(&:to_s) ).to eq( %w{1 2 3 4} )
expect( array.new_map{ |e| e + 2 } ).to eq( [3, 4, 5, 6] )
end
it "does not call #map" do
array = [1,2,3,4]
array.stub(:map) { '' } …Run Code Online (Sandbox Code Playgroud)