नीचे फ़ाइल अपलोड करने के लिए मेरा परीक्षण कोड है।fixture_file_upload में {file} मौजूद नहीं है त्रुटि
describe "file process" do
before(:each) do
# debugger
@file = fixture_file_upload('test.csv', 'text/csv')
end
it "should be able to upload file" do
post :upload_csv, :upload => @file
response.should be_success
end
end
हालांकि, जब मैं rspec कल्पना चलाने के लिए, यह मुझे त्रुटि
Failure/Error: @file = fixture_file_upload('test.csv', 'text/csv')
RuntimeError:
test.csv file does not exist
# ./spec/controllers/quotation_controller_spec.rb:29:in `block (3 levels) in <top (required)>'
नीचे उत्पादित मैं स्थानों में से बहुत googled है लेकिन मैं अभी भी बाहर क्या इसके पीछे कारण नहीं पा सके। कोई उपाय?
में रखा जाना चाहिए SO [http://stackoverflow.com/questions/3966263/attachment-fu-testing-in-rails-3 ](http:// से एक समाधान मिला stackoverflow.com/questions/3966263/attachment-fu-testing-in-rails-3)। जाहिर है, मुझे इस लाइन के साथ fixture_file_upload को प्रतिस्थापित करना है '@file = रैक :: टेस्ट :: अपलोड किया गया File.new (Rails.root.join (' spec/fixtures/test.csv '),' text/csv ')' – hanchee
fixture_file_upload रेल 3.1 के साथ काम नहीं कर रहा है? – hanchee
हमने इसे 3.2 – plainjimbo