Sha256: 0f62aae80745fe303da398656bb075bd62fbea3e1fb3030a7f940b2840fac728

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

describe DownloadTV::MyEpisodes do
  let(:save_cookie) { true }
  let(:page) { double('page') }
  let(:agent) { double('agent', :user_agent= => nil, get: page) }
  let(:cookie_jar) { double('cookie_jar') }
  subject { described_class.new('user', true) }

  before :each do
    allow(Mechanize).to receive(:new).and_return agent
    allow(agent).to receive(:cookie_jar).and_return cookie_jar
    allow(cookie_jar).to receive(:load)
    allow(cookie_jar).to receive(:save)
  end

  describe '#initialize' do
    context 'when cookie does not load' do
      it 'will execute a user/password login' do
        allow_any_instance_of(described_class).to receive(:load_cookie).and_return false
        expect_any_instance_of(described_class).to receive(:manual_login).once.and_return nil
        subject
      end
    end

    context 'when using a valid cookie' do
      it 'will log in via cookie' do
        allow_any_instance_of(described_class).to receive(:load_cookie).and_return true
        expect_any_instance_of(described_class).not_to receive(:manual_login)
        subject
      end
    end
  end

  describe '#get_shows_since' do
    # TODO
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
download_tv-2.9.1 spec/download_tv/myepisodes_spec.rb
download_tv-2.9.0 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.5 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.4 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.3 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.2 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.1 spec/download_tv/myepisodes_spec.rb
download_tv-2.8.0 spec/download_tv/myepisodes_spec.rb
download_tv-2.7.0 spec/download_tv/myepisodes_spec.rb
download_tv-2.6.10 spec/download_tv/myepisodes_spec.rb
download_tv-2.6.9 spec/download_tv/myepisodes_spec.rb
download_tv-2.6.8 spec/download_tv/myepisodes_spec.rb
download_tv-2.6.7 spec/download_tv/myepisodes_spec.rb