json_spec 在RSpec和Cucumber中轻松处理JSON 规范 json_spec定义了五个新的RSpec匹配器: be_json_eql include_json have_json_path have_json_type have_json_size 可以在RSpec中使用新的匹配器,如下所示: describe User do let ( :user ) { User . create! ( first_name : "Steve" , last_name : "Richert" ) } context "#to_json" do it "includes names" do names = %({"first_name":"Steve","last_name":"Richert"}) user . to_json