我正在测试lib/pdf_helper.rb.所以我创建spec/lib目录.然后我pdf_helper_spec.rb在spec/lib目录中创建一个文件.因为我正在测试pdf文件夹应该在公共文件夹中,这是我的代码
require 'spec_helper'
require 'pdf_helper'
describe "Pdfhelpers" do
it "Should be in public folder" do
file = File.new ("#{Rails.root}/public/pdf")
if File.exist?(file) == 'true'
puts "Success"
else
puts"failed"
end
end
end
Run Code Online (Sandbox Code Playgroud)
我对吗??我是RSpec的新手.
pdfkit gem成功安装在我的机器上.然后我跑gem install wkhtmltopdf-binary,输出了
Successfully installed wkhtmltopdf-binary-0.9.9.1
1 gem installed
Installing ri documentation for wkhtmltopdf-binary-0.9.9.1...
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping
unable to convert "\xA3" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_x64, skipping
unable to convert "\xCE" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_darwin_386, skipping
Installing RDoc documentation for wkhtmltopdf-binary-0.9.9.1...
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping
unable to convert "\xA3" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_x64, skipping
unable to convert …Run Code Online (Sandbox Code Playgroud) 我想制作我的日期格式Month-Date-Year.目前的格式是Year-Month-Date.我如何在PHP中执行此操作?
[
{
"description": "My home",
"name": "Sweet Home",
"point": {
"lat": 22.890976,
"long": 90.459097
},
"type": 1,
"cid": "5319197376176516414"
}
Run Code Online (Sandbox Code Playgroud)
这是我的json文件,用于解析信息.这是我解析名称和lng的代码.
BufferedReader jsonReader = new BufferedReader(new InputStreamReader(this.getResources().openRawResource(R.raw.map)));
StringBuilder jsonBuilder = new StringBuilder();
try {
for (String line = null; (line = jsonReader.readLine()) != null;) {
jsonBuilder.append(line).append("\n");
}
JSONTokener tokener = new JSONTokener(jsonBuilder.toString());
JSONArray jsonArray = new JSONArray(tokener);
JSONObject jsonObject = jsonArray.getJSONObject(0);
String title = jsonObject.getString("name");
String lhg = jsonObject.getJSONObject("point").getString("lng");
} catch (FileNotFoundException e) {
Log.e("jsonFile", "file not found");
} catch …Run Code Online (Sandbox Code Playgroud)