RoR:测试在本地传递,但在Travis失败

时间:2015-09-20 14:44:18

标签: ruby-on-rails unit-testing travis-ci

我正在构建一个Ruby on Rails应用程序,而且我遇到了测试问题。我试图断言一篇文章有​​一个链接到它的图片(使用paperclip gem)。 它在本地正常工作,但在travis运行测试单元时失败。

有人知道我的考试有什么问题吗?

这是我的测试

  test 'should have picture linked' do
    @home_post = posts(:home)
    attachment = fixture_file_upload 'images/bart.png', 'image/png'
    Picture.create(image: attachment, attachable_type: 'Post', attachable_id: @home_post.id)
    assert @home_post.pictures?, 'should have picture linked to home article'
  end

以下是方法图片?

  def pictures?
    pictures.online.first.present? && pictures.online.first.image.exists?
  end

我的猜测是没有使用travis上传灯具,«exists?'方法总是返回false。 有没有办法让travis通过这个测试?

感谢您的帮助

我的项目

  • Rails 4.2.4
  • Ruby 2.2.2
  • Rails Minitest(不是rspec)

0 个答案:

没有答案
相关问题