spec/upyun_spec.rb in upyun-1.0.5 vs spec/upyun_spec.rb in upyun-1.0.6
- old
+ new
@@ -90,10 +90,15 @@
expect(File.exists?('./save.jpg')).to eq(true)
expect(File.read('./save.jpg')).to eq(@str)
File.delete('./save.jpg')
end
+ it "GET a file with Accept Header" do
+ expect(@upyun.get(@path, nil, {'Accept' => '*/*'})).to eq(@str)
+ end
+
+
it "GET a not-exist file" do
res = @upyun.get("/ruby-sdk/foo/#{String.random}/test-not-exist.jpg")
expect(res.is_a?(Hash) && res[:error][:code] == 404)
end
@@ -191,11 +196,10 @@
it "with file path should success" do
res = @form.upload(@file)
expect(res.keys).to include(:code, :message, :url, :time)
expect(res[:code]).to eq(200)
expect(res[:message]).to match(/ok/)
- now = Time.now
- expect(res[:url]).to eq("/#{now.year}/#{now.mon}/#{now.day}/upyun.jpg")
+ expect(res[:url]).to eq(Time.now.utc.strftime('/%Y/%m/%d/upyun.jpg'))
end
it "with file descriptor should success" do
fd = File.new(@file, 'rb')
res = @form.upload(fd)