Sha256: fd9913091562a64fba9b2118c6608caf2c62d296c7957c005c1934a95651f9ef

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

require 'spec_helper'

describe Sufia::GenericFile::Actor do
  describe "#virus_check" do
    it "should return the results of running ClamAV scanfile method" do
      ClamAV.instance.should_receive(:scanfile).and_return(1)
      expect { Sufia::GenericFile::Actor.virus_check(File.new(fixture_path + '/world.png')) }.to raise_error(Sufia::VirusFoundError)
    end
  end

  describe "#featured_work" do
    let(:user) { FactoryGirl.create(:user) }
    let(:gf) { FactoryGirl.create(:generic_file, visibility: 'open') }
    let(:actor) { Sufia::GenericFile::Actor.new(gf, user)}

    before { FeaturedWork.create(generic_file_id: gf.noid) }

    after { gf.destroy }

    it "should be removed if document is not public" do
      # Switch document from public to restricted
      attributes = {'permissions'=>{'group' =>{'public' => '1', 'registered'=>'2'}}}
      expect { actor.update_metadata(attributes, 'restricted') }.to change { FeaturedWork.count }.by(-1)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-4.0.0.rc2 spec/actors/generic_file/actor_spec.rb