Sha256: 03bb54d5b1efd926d891045b6636fff862bb3886630780eb2626de6d64efc161

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe CopyTunerClient::RequestSync do

  let(:cache) { {} }
  let(:response) { 'response' }
  let(:env) { 'env' }
  let(:app) { stub('app', :call => response) }
  before { cache.stubs(:flush => nil, :download => nil) }
  subject { CopyTunerClient::RequestSync.new(app, :cache => cache) }

  it "invokes the upstream app" do
    result = subject.call(env)
    app.should have_received(:call).with(env)
    result.should == response
  end

  it "flushes defaults" do
    subject.call(env)
    cache.should have_received(:flush)
  end

  it "downloads new copy" do
    subject.call(env)
    cache.should have_received(:download)
  end
end

describe CopyTunerClient::RequestSync, 'serving assets' do
  let(:env) do
    { "PATH_INFO" => '/assets/choper.png' }
  end
  let(:cache) { {} }
  let(:response) { 'response' }
  let(:app) { stub('app', :call => response) }
  before { cache.stubs(:flush => nil, :download => nil) }
  subject { CopyTunerClient::RequestSync.new(app, :cache => cache) }

  it "does not flush defaults" do
    subject.call(env)
    cache.should_not have_received(:flush)
  end
  it "does not download new copy" do
    subject.call(env)
    cache.should_not have_received(:download)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
copy_tuner_client-0.0.1 spec/copy_tuner_client/request_sync_spec.rb