Sha256: df8b19b829cbcef5591fbd66e61ca8000839ad649e0530adc06dd3a8f7d46789

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require 'rails_helper'

describe MrVideo::CassettesController do
  routes { MrVideo::Engine.routes }

  render_views

  describe '#index' do
    let(:index) { get(:index) }

    subject { index }

    before do
      index
    end

    it { should be_success }
  end

  describe '#show' do
    let(:id) { 'bell_house' }
    let(:params) { { id: id } }
    let(:show) { get(:show, params) }

    subject { show }

    before do
      show
    end

    it { should be_success }
  end

  describe '#destroy' do
    let(:id) { 'bell_house' }
    let(:cassette) { double(:cassette, id: id) }
    let(:params) { { id: id } }
    let(:destroy) { xhr(:delete, :destroy, params) }

    subject { destroy }

    before do
      expect(MrVideo::Cassette).to receive(:find).with(id) { cassette }
      allow(cassette).to receive(:destroy)
      destroy
    end

    it { should be_success }

    it 'should destroy the cassette' do
      expect(cassette).to have_received(:destroy)
    end
  end # #destroy

end # MrVideo::CassettesController

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mr_video-1.0.5 spec/controllers/mr_video/cassettes_controller_spec.rb
mr_video-1.0.4 spec/controllers/mr_video/cassettes_controller_spec.rb
mr_video-1.0.2 spec/controllers/mr_video/cassettes_controller_spec.rb
mr_video-1.0.1 spec/controllers/video_store/cassettes_controller_spec.rb
mr_video-1.0.0 spec/controllers/video_store/cassettes_controller_spec.rb