水豚找不到文件
Capybara can't find file
当 运行 RSpec:
时出现此错误
Failures:
1) Creating a new movie saves the movie and shows the new movie's details
Failure/Error: attach_file "Poster image", with: "#{Rails.root}/app/assets/images/interstellar.jpg"
Capybara::FileNotFound:
cannot attach file, [:with, "/Users/Ian/code/courses/ruby_on_rails_1/flix-tdd/app/assets/images/interstellar.jpg"]does not exist
但是,我检查了一下,文件似乎在那里:
File.exist?("#{Rails.root}/app/assets/images/interstellar.jpg")
=> true
File.exist?("/Users/Ian/code/courses/ruby_on_rails_1/flix-tdd/app/assets/images/interstellar.jpg")
=> true
我在这里错过了什么?
为什么不呢?
attach_file "Poster image", "#{Rails.root}/app/assets/images/interstellar.jpg"
http://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Actions#attach_file-instance_method
当 运行 RSpec:
时出现此错误Failures:
1) Creating a new movie saves the movie and shows the new movie's details
Failure/Error: attach_file "Poster image", with: "#{Rails.root}/app/assets/images/interstellar.jpg"
Capybara::FileNotFound:
cannot attach file, [:with, "/Users/Ian/code/courses/ruby_on_rails_1/flix-tdd/app/assets/images/interstellar.jpg"]does not exist
但是,我检查了一下,文件似乎在那里:
File.exist?("#{Rails.root}/app/assets/images/interstellar.jpg")
=> true
File.exist?("/Users/Ian/code/courses/ruby_on_rails_1/flix-tdd/app/assets/images/interstellar.jpg")
=> true
我在这里错过了什么?
为什么不呢?
attach_file "Poster image", "#{Rails.root}/app/assets/images/interstellar.jpg"
http://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Actions#attach_file-instance_method