Sha256: 0db77db5b92ff0eefbf3390023ad74818eee9ab8df39bf5dd88031fa81096c6b
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
require File.expand_path("../../spec_helper", __FILE__) describe CommentsController do before :each do @comment = Comment.new( :text => 'my comment', :user => User.new( :login_id => 'ping', :display_name => 'Ping the Duck', :email => 'ping@yellow-river.tld' )) end describe "GET index" do before :each do Comment.should_receive(:all).and_return( [@comment] ) end it "includes user in the xml" do get :index, :format => 'xml' response.body.should have_xpath("/comments/comment/user/display-name") end it "includes user in the json" do get :index, :format => 'json' response.body.should == [@comment].to_json(:include => :user ) end end describe "GET show" do before :each do Comment.should_receive(:find).and_return( @comment ) end it "includes user in the xml" do get :show, {:id => '1', :format => 'xml'} response.body.should have_xpath("/comment/user/display-name") end it "includes user in the json" do get :show, {:id => '1', :format => 'json'} response.body.should == @comment.to_json( :include => :user ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resource_inclusion-0.0.2 | test/app/spec/controllers/comments_controller_spec.rb |
resource_inclusion-0.0.1 | test/app/spec/controllers/comments_controller_spec.rb |