Sha256: eba03fa24b2353fb30fb1fd9b7ff9bc860f9ec30397ff2228e3c4248a450ae4b

Contents?: true

Size: 922 Bytes

Versions: 10

Compression:

Stored size: 922 Bytes

Contents

require "spec_helper"
require "nightcrawler_swift/cli"

describe NightcrawlerSwift::CLI::UrlFor do

  let(:connection) { NightcrawlerSwift::Connection.new }
  let(:token) { "token" }
  let(:expires_at) { (DateTime.now + 60).to_time }
  let(:public_url) { "server-url" }
  let(:bucket) { "rogue" }

  subject do
    NightcrawlerSwift::CLI::UrlFor.new
  end

  before do
    allow(NightcrawlerSwift).to receive(:connection).and_return(connection)
    allow(connection).to receive(:token_id).and_return(token)
    allow(connection).to receive(:expires_at).and_return(expires_at)
    allow(connection).to receive(:public_url).and_return(public_url)
    NightcrawlerSwift.configure bucket: bucket
  end

  describe "#execute" do
    let :execute do
      subject.execute "file_path"
    end

    it "returns the public url of the given path" do
      expect(execute).to eql("server-url/#{bucket}/file_path")
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nightcrawler_swift-1.0.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.11.1 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.11.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.10.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.9.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.8.1 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.8.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.7.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.6.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb
nightcrawler_swift-0.5.0 spec/lib/nightcrawler_swift/cli/commands/url_for_spec.rb