Sha256: 7990c812244e115d5af367468c54ec2a6d8ec38e6ce79d5f7bacf675338350df

Contents?: true

Size: 936 Bytes

Versions: 32

Compression:

Stored size: 936 Bytes

Contents

module Ddr::Models
  RSpec.describe FileCharacterization do

    subject { described_class.new(obj) }

    let(:obj) { FactoryGirl.create(:component) }
    let(:fits_output) { "<fits/>" }

    before {
      allow(subject).to receive(:with_content_file).and_yield("/tmp/foobar")
    }

    describe "when there is an error running FITS" do
      before {
        allow(subject).to receive(:run_fits).with("/tmp/foobar").and_raise(FileCharacterization::FITSError)
      }
      specify {
        begin
          subject.call
        rescue FileCharacterization::FITSError
        ensure
          expect(subject.fits).not_to have_content
        end
      }
    end

    describe "when FITS runs successfully" do
      before {
        allow(subject).to receive(:run_fits).with("/tmp/foobar") { fits_output }
      }
      specify {
        subject.call
        expect(subject.fits.content).to eq(fits_output)
      }
    end

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
ddr-models-3.0.8 spec/models/file_characterization_spec.rb
ddr-models-3.0.7 spec/models/file_characterization_spec.rb
ddr-models-3.0.6 spec/models/file_characterization_spec.rb
ddr-models-3.0.5 spec/models/file_characterization_spec.rb
ddr-models-3.0.4 spec/models/file_characterization_spec.rb
ddr-models-3.0.3 spec/models/file_characterization_spec.rb
ddr-models-3.0.2 spec/models/file_characterization_spec.rb
ddr-models-3.0.1 spec/models/file_characterization_spec.rb
ddr-models-3.0.0 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc6 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc5 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc4 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc3 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc2 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.rc1 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.beta.22 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.beta.21 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.beta.20 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.beta.18 spec/models/file_characterization_spec.rb
ddr-models-3.0.0.beta.17 spec/models/file_characterization_spec.rb