summaryrefslogtreecommitdiff
path: root/spec/controllers/comments_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/comments_controller_spec.rb')
-rw-r--r--spec/controllers/comments_controller_spec.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb
index 1b4fb834..1ea63211 100644
--- a/spec/controllers/comments_controller_spec.rb
+++ b/spec/controllers/comments_controller_spec.rb
@@ -4,15 +4,29 @@ require 'fakes-rspec'
describe CommentsController do
let(:sut) { CommentsController.new }
+
describe 'when commenting on a creation' do
- let(:comment) { fake }
+ let(:flash_hash) { {} }
+ let(:payload){ {:creation_id=>88, :comment => {:body => 'blah'}} }
+ let(:command){ fake }
+
+ before(:each) do
+ sut.stub(:params).and_return(payload)
+ sut.stub(:flash).and_return(flash_hash)
+ sut.stub(:redirect_to).and_return(nil)
+ sut.stub(:command_for).with(CommentOnCreationCommand).and_return(command)
+
+ sut.create
+ end
it "should save the new comment" do
- #comment.should have_receieved(:save)
+ command.should have_received(:run, payload)
end
- before(:each) do
- #Comment.stub(:build_from).and_return(comment)
- #sut.create
+ it "should display a message indicated that the comment was saved" do
+ flash_hash[:notice].should_not be_nil
+ end
+ it "should redirect to the creation#show page" do
+
end
end
end