Sha256: ab9bdf72416e4a025462a8c5595c09beb7916a0a8cb7c5bfccd9cb259c45e2c5
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require "spec_helper" describe NightcrawlerSwift::List do let(:connection) { NightcrawlerSwift::Connection.new } let(:token) { "token" } let(:expires_at) { (DateTime.now + 60).to_time } let(:upload_url) { "server-url" } subject do NightcrawlerSwift::List.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(:upload_url).and_return(upload_url) end describe "#execute" do let :json_response do [{"name" => "file"}] end let :response do double(:response, code: 200, body: json_response.to_json) end before do allow(subject).to receive(:get).and_return(response) end it "gets upload url" do subject.execute expect(subject).to have_received(:get).with(connection.upload_url, headers: {accept: :json}) end it "returns the parsed json" do result = subject.execute expect(result).to eql json_response end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nightcrawler_swift-0.5.0 | spec/lib/nightcrawler_swift/commands/list_spec.rb |