From 55228c4462f899ee0e005e8138c14cfd071134e9 Mon Sep 17 00:00:00 2001 From: Teyler Halama Date: Wed, 11 May 2022 21:00:22 +0100 Subject: [PATCH] chore: clean glitter spec. add server spec --- spec/lib/glitter_spec.rb | 26 ++++++++------------------ spec/lib/server_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 spec/lib/server_spec.rb diff --git a/spec/lib/glitter_spec.rb b/spec/lib/glitter_spec.rb index 10d3268..8f74adc 100644 --- a/spec/lib/glitter_spec.rb +++ b/spec/lib/glitter_spec.rb @@ -2,16 +2,15 @@ require 'rexml/document' describe Glitter do - let(:server) do - Glitter::Server.new - end - it "Glitter takes in an optional -t flag and passes the proper timeout to S3" do - server = Glitter::Server.new() # no timeout passed in - expect(server.timeout).to eq Glitter::Server::DEFAULT_S3_TIMEOUT - server = Glitter::Server.new(timeout: 10) # timeout passed in - expect(server.timeout).to eq 10 - end + # # Note that uncommenting and running this spec *will* upload a single file to your S3 bucket + # it "should release to channel" do + # Glitter::Release::Sparkle.new Glitter::Server.new.channel('test-channel'), "1.1.2-#{rand}" do |r| + # r.executable = File.open(__FILE__) + # r.notes = %[Did you know that its #{Time.now}? Wait, you can only answer yes to that question.] + # r.minimum_system_version = "10.10" + # end.push.head + # end it "AWS path segments are parsed correctly for an item at top level of version folder" do channel, version, key = Glitter::Release.object_segments("/channel/version/some-item") @@ -27,12 +26,3 @@ expect(key).to eq("some-dir/some-item") end end - - # # Note that uncommenting and running this spec *will* upload a single file to your S3 bucket - # it "should release to channel" do - # Glitter::Release::Sparkle.new server.channel('test-channel'), "1.1.2-#{rand}" do |r| - # r.executable = File.open(__FILE__) - # r.notes = %[Did you know that its #{Time.now}? Wait, you can only answer yes to that question.] - # r.minimum_system_version = "10.10" - # end.push.head - # end diff --git a/spec/lib/server_spec.rb b/spec/lib/server_spec.rb new file mode 100644 index 0000000..6b872fc --- /dev/null +++ b/spec/lib/server_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' +require 'rexml/document' + +describe Glitter::Server do + describe "#new" do + context "No timeout flag is passed to the server constructor" do + let(:server) { Glitter::Server.new } + + it "defaults to the default timeout" do + expect(server.timeout).to eq Glitter::Server::DEFAULT_S3_TIMEOUT + end + end + + context "A timeout flag is passed to the server constructor" do + let(:server) { Glitter::Server.new(timeout: 10) } + + it "will have a timeout value of the passed timeout flag" do + expect(server.timeout).to eq 10 + end + end + end +end