Sha256: d3c203de08786256f437df6113478b4236c17663c1b6f1759e247d153501612b

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'rails_helper'

describe MrVideo::Cassette do
  let(:model_class) { MrVideo::Cassette }
  let(:model) { model_class.find('bell_house') }

  subject { model }

  describe '#name' do
    let(:name) { model.name }
    subject { name }
    it { should == 'bell_house' }
  end

  describe '#updated_at' do
    let(:updated_at) { model.updated_at }
    subject { updated_at }
    it { should be_kind_of(DateTime) }
  end # #updated_at

  describe '#episodes' do
    let(:episodes) { model.episodes }
    subject { episodes }
    it { should have(3).items }

    describe '1st episode' do
      let(:episode) { episodes[0] }
      subject { episode }
      its(:cassette) { should == model }
    end

    describe '#find' do
      let(:episode) { episodes.find(0) }
      subject { episode }
      it { should be }
    end

  end # #episodes

  describe '#destroy' do
    before do
      File.stub(:delete)
      model.destroy
    end

    it 'should delete the file' do
      File.should have_received(:delete).with(model.send(:cassette_path))
    end

  end # #destroy

  describe '#to_param' do
    let(:to_param) { model.to_param }
    subject { to_param }
    it { should == 'bell_house' }
  end

  describe '.all' do
    let(:all) { model_class.all }
    subject { all }
    its(:size) { should == 5 }
  end # .all

end # MrVideo::Cassette

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mr_video-1.0.2 spec/models/mr_video/cassette_spec.rb
mr_video-1.0.1 spec/models/mr_video/cassette_spec.rb
mr_video-1.0.0 spec/models/mr_video/cassette_spec.rb