Sha256: 19270ffcf0f817de8b0067f468eec0829acc946966c65a1829ba84abf1427efb
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require "spec_helper" describe "Recipes" do let(:env) do { "HTTP_ACCEPT" => "application/json" } end let(:params) do {} end describe "GET /recipes/:id" do let(:recipe) do Recipe.create(name: "test", type: 2) end context "with valid condition (using Rack::Test)", :autodoc do include Rack::Test::Methods it "returns the recipe" do get "/recipes/#{recipe.id}", params, env last_response.status.should == 200 end end end describe "POST /recipes" do before do params[:name] = "name" params[:type] = 1 end context "without required param" do before do params.delete(:name) end it "returns 400" do post "/recipes", params, env response.status.should == 400 end end context "with other typed param" do before do params[:type] = "x" end it "returns 400" do post "/recipes", params, env response.status.should == 400 end end context "without non-required param" do before do params.delete(:type) end it "creates a new recipe" do post "/recipes", params, env response.status.should == 201 end end context "with valid condition", :autodoc do it "creates a new recipe" do post "/recipes", params, env response.status.should == 201 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
autodoc-0.2.8 | spec/requests/recipes_spec.rb |
autodoc-0.2.7 | spec/requests/recipes_spec.rb |
autodoc-0.2.6 | spec/requests/recipes_spec.rb |