Sha256: 5131fb1910d0ec030e9dfe2451ecff54ae502ebcf3b3ae3544dca69de8cb9e61
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
require 'spec_helper' require 'test_models' describe Jsonify do it "should find all objects and convert to json for index url" do pizzas = [{name: 'cheese'}, {name: 'chicken'}] ::Pizza.expects(:all).returns(pizzas) jsonify = Jsonify.new('/pizzas', ::Pizza) status, header, response = jsonify.call('REQUEST_PATH' => '/pizzas') status.should == 200 header['Content-Type'].should == 'application/json' response.first.should == pizzas.to_json end it "should find object by id and convert to json for show url" do pizza = {name: 'cheese'} ::Pizza.expects(:find).with('cheese').returns(pizza) jsonify = Jsonify.new('/pizzas', ::Pizza) status, header, response = jsonify.call('REQUEST_PATH' => '/pizzas/cheese') status.should == 200 header['Content-Type'].should == 'application/json' response.first.should == pizza.to_json end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scrapify-0.0.4 | spec/jsonify_spec.rb |
scrapify-0.0.3 | spec/jsonify_spec.rb |
scrapify-0.0.2 | spec/jsonify_spec.rb |