Sha256: b8214e9524b4335b4ca8b19da19c28347a8fb50ad22cd05c3665f08d4f566bc0

Contents?: true

Size: 1.9 KB

Versions: 6

Compression:

Stored size: 1.9 KB

Contents

require 'rails_helper'

describe MrVideo::Episode do
  let(:episode_class) { MrVideo::Episode }
  let(:cassette) { MrVideo::Cassette.find('dummy_cassette') }
  let(:episode) { cassette.episodes[0] }

  subject { episode }

  describe 'properties' do

    describe '#id' do
      let(:id) { episode.id }
      subject { id }
      it { should == episode.url.hash }
    end

    describe '#url' do
      let(:url) { episode.url }
      subject { url }
      it { should == 'http://www.thebellhouseny.com/calendar/' }
    end

    describe '#request_method' do
      let(:request_method) { episode.request_method }
      subject { request_method }
      it { should == 'get' }
    end

    describe '#website_url' do
      let(:website_url) { episode.website_url }
      subject { website_url }
      it { should == 'http://www.thebellhouseny.com' }
    end

    describe '#content' do
      let(:content) { episode.content }
      subject { content }
      it { should match(/<html/) }
    end

    describe '#content_type' do
      let(:content_type) { episode.content_type }
      subject { content_type }
      it { should == 'text/html; charset=UTF-8' }
    end

    describe '#recorded_at' do
      let(:recorded_at) { episode.recorded_at }
      subject { recorded_at }
      it { should == Time.zone.parse('Wed, 04 Jun 2014 15:44:06').to_datetime }
    end

  end # properties

  describe '#to_param' do
    let(:to_param) { episode.to_param }
    subject { to_param }
    it { should == episode.id.to_s }
  end

  describe '#destroy' do
    let(:original_cassette) { MrVideo::Cassette.find('dummy_cassette') }

    before do
      original_cassette.load
      episode.destroy
      cassette.reload
    end

    after do
      original_cassette.save!
    end

    context 'cassette#episodes' do
      it 'should have destroyed the episode' do
        expect(cassette.episodes).to have(2).items
      end
    end

  end

end # MrVideo::Episode

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mr_video-1.1.0 spec/models/mr_video/episode_spec.rb
mr_video-1.0.5 spec/models/mr_video/episode_spec.rb
mr_video-1.0.4 spec/models/mr_video/episode_spec.rb
mr_video-1.0.2 spec/models/mr_video/episode_spec.rb
mr_video-1.0.1 spec/models/mr_video/episode_spec.rb
mr_video-1.0.0 spec/models/mr_video/episode_spec.rb