Sha256: 5dc259a503b50beeea3922f51cef9be9f698b6ece83708aa126b3ead2261ae6b

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require 'spec_helper'

RSpec.describe Roroacms::CommentsController, :type => :controller do

  let!(:record) { FactoryGirl.create(:post) }

  before(:each) do
    request.env["HTTP_REFERER"] = "where_i_came_from"
  end

  describe "POST #create" do

    it "should create the comment" do
      expect{post :create, { use_route: :roroacms, comment: FactoryGirl.attributes_for(:comment, post_id: record.id) } }.to change(Roroacms::Comment, :count).by(1)
    end

    it "should redirect back to the referring page" do
      post :create, { use_route: :roroacms, comment: FactoryGirl.attributes_for(:comment, post_id: record.id) }
      expect(response).to redirect_to "where_i_came_from#commentsArea"
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roroacms-0.0.7 spec/controllers/roroacms/comments_controller_spec.rb