remarkable-rb / remarkable

Simplifying tests!
http://www.nomedojogo.com/category/remarkable/
MIT License
120 stars 64 forks source link

Macros for Rack #10

Open hosh opened 14 years ago

hosh commented 14 years ago

So some sample Rack macros:

it { should comply_with_rack_api}
it { should redirect_to "/" }
it { should respond_with :404, /We cannot find the page/ }

If the subject_attributes pattern gets implemented cleanly, maybe:

describe :post => "/users/memberships", :json => { :user_id => "foobear" } do
   it { should respond_with valid_rack_response } 
   it { should respond_with :200, :ok }
end

Thought it might end up with something like:

describe RackEndpoint do
  when_receiving :post => "/users/memberships", :json => { :user_id => "foobear" } do
    it { should respond_with valid_rack_response } 
    it { should respond_with :200, :ok }
  end
end

(to avoid having to wrap around describe)