mardi 5 mai 2015

Rspec Rails Testing for PublicActivity creation in controller test

I am testing the update method of a controller and part of the update creates a custom activity using the PublicActivity gem. When testing in Rspec the activities do not seem to be created. Here is the test that is failing:

it "creates a shared activity" do
      PublicActivity.with_tracking do
        expect{
            put :update, user_id: @michael, id: @michaels_task, task: FactoryGirl.attributes_for(:task, users_shared_to_ids: [@archer.id])
          }.to change(PublicActivity::Activity,:count).by(1)
      end
    end

I know that the put :update line works correctly as I can pass other tests looking for other changes relating to sharing the task.

Aucun commentaire:

Enregistrer un commentaire