I am trying to test that a particular Rails controller action deletes all 
items and then recreates them from an RSS feed. The new class_spy method 
seemed just perfect for what I was trying to do but I can't get it to work. 
What am I misunderstanding from the docs?

/app/controllers/news_configuration_controller.rb

class NewsConfigurationController < ApplicationController
  # GET /news_configuration/refresh_from_www
  def refresh_from_www
    NewsRelease.delete_all
    redirect_to news_configuration_path
  end
end

/spec/controllers/news_configuration_controller_spec.rb

RSpec.describe NewsConfigurationController, :type => :controller do

  describe "GET 'refresh_from_www'" do
    it "refreshes news releases" do
      news_release_class = class_spy("NewsRelease")
      get :refresh_from_www, { }, valid_session
      expect(news_release_class).to have_received(:delete_all)
    end



-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/4447f117-4857-46eb-9c49-44fab1ca5bfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to