Skip to content

Commit

Permalink
chore: clean glitter spec. add server spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Teyler7 committed May 12, 2022
1 parent a5dc167 commit 55228c4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
26 changes: 8 additions & 18 deletions spec/lib/glitter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
22 changes: 22 additions & 0 deletions spec/lib/server_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 55228c4

Please sign in to comment.