小编Jam*_*sJY的帖子

设计 - 在开发中删除用户确认

如何在开发中跳过用户确认.

我已经设置了生产环境以使用SendGrid发送电子邮件,但现在我已经完成了它不会让我登录.

谢谢你的时间!

ruby ruby-on-rails devise devise-confirmable ruby-on-rails-4

3
推荐指数
1
解决办法
1155
查看次数

如何在我的rspec测试中考虑随机数?

我有一个问题,即当随机数低于20时,这些测试才会通过,我如何在我的测试中考虑到这一点?

我的测试:

it 'a plane cannot take off when there is a storm brewing' do
    airport = Airport.new [plane]
    expect(lambda { airport.plane_take_off(plane) }).to raise_error(RuntimeError) 
end

it 'a plane cannot land in the middle of a storm' do
    airport = Airport.new []
    expect(lambda { airport.plane_land(plane) }).to raise_error(RuntimeError) 
end
Run Code Online (Sandbox Code Playgroud)

我的代码摘录:

def weather_rand
  rand(100)
end

def plane_land plane
  raise "Too Stormy!" if weather_ran <= 20
  permission_to_land plane
end

def permission_to_land plane
  raise "Airport is full" if full?
  @planes << plane
  plane.land!
end

def …
Run Code Online (Sandbox Code Playgroud)

ruby rspec ruby-on-rails ruby-on-rails-3

2
推荐指数
1
解决办法
2039
查看次数