terminal.com 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +118 -29
- data/bin/terminal.com +12 -7
- data/lib/terminal.com.rb +998 -317
- data/lib/terminal.com/api.rb +202 -0
- data/spec/low-level/browse_snapshots_and_users_spec.rb +158 -0
- data/spec/low-level/create_and_manage_terminals_spec.rb +199 -0
- data/spec/low-level/terminal.com_spec.rb +31 -0
- data/spec/spec_helper.rb +79 -0
- metadata +9 -5
- data/spec/terminal.com_spec.rb +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
describe Terminal do
|
2
|
+
describe 'constants' do
|
3
|
+
it 'specifies API_VERSION' do
|
4
|
+
expect(described_class::API_VERSION).to eql('v0.1')
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'specifies default headers' do
|
8
|
+
expect(described_class::HEADERS['Content-Type']).to eql('application/json')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.ensure_options_validity' do
|
13
|
+
it 'raises an argument error if provided option is NOT in the list of allowed options' do
|
14
|
+
expect {
|
15
|
+
described_class.ensure_options_validity({d: 1}, :a, :b, :c)
|
16
|
+
}.to raise_error(ArgumentError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'does NOT raise an error if provided option is in the list of allowed options' do
|
20
|
+
expect {
|
21
|
+
described_class.ensure_options_validity({a: 1}, :a, :b, :c)
|
22
|
+
}.not_to raise_error
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'provides a helpful error message' do
|
26
|
+
expect {
|
27
|
+
described_class.ensure_options_validity({d: 1}, :a, :b, :c)
|
28
|
+
}.to raise_error(ArgumentError, /Unrecognised options: :d/)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
require 'terminal.com'
|
5
|
+
|
6
|
+
ENV['DBG'] = 'curl'
|
7
|
+
|
8
|
+
VCR.configure do |config|
|
9
|
+
config.cassette_library_dir = 'spec/low-level/fixtures'
|
10
|
+
config.hook_into :webmock # or :fakeweb
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.include Module.new {
|
15
|
+
def credentials
|
16
|
+
@credentials ||= YAML.load_file('spec/credentials.yml')
|
17
|
+
end
|
18
|
+
|
19
|
+
def user_token
|
20
|
+
credentials[:user_token]
|
21
|
+
end
|
22
|
+
|
23
|
+
def access_token
|
24
|
+
credentials[:access_token]
|
25
|
+
end
|
26
|
+
|
27
|
+
def ubuntu_snap_id
|
28
|
+
'987f8d702dc0a6e8158b48ccd3dec24f819a7ccb2756c396ef1fd7f5b34b7980'
|
29
|
+
end
|
30
|
+
}
|
31
|
+
|
32
|
+
#
|
33
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
34
|
+
#
|
35
|
+
|
36
|
+
# Run only examples tagged with :focus or, if none, everything.
|
37
|
+
config.filter_run :focus
|
38
|
+
config.run_all_when_everything_filtered = true
|
39
|
+
|
40
|
+
# Enable warnings.
|
41
|
+
config.warnings = true
|
42
|
+
|
43
|
+
if config.files_to_run.one?
|
44
|
+
# Allow more verbose output when running one file only.
|
45
|
+
config.default_formatter = 'doc'
|
46
|
+
else
|
47
|
+
# Show 3 slowest examples when running the full suite.
|
48
|
+
config.profile_examples = 3
|
49
|
+
end
|
50
|
+
|
51
|
+
# Run specs in random order to surface order dependencies. If you find an
|
52
|
+
# order dependency and want to debug it, you can fix the order by providing
|
53
|
+
# the seed, which is printed after each run.
|
54
|
+
# --seed 1234
|
55
|
+
config.order = :random
|
56
|
+
|
57
|
+
# rspec-expectations config goes here. You can use an alternate
|
58
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
59
|
+
# assertions if you prefer.
|
60
|
+
config.expect_with :rspec do |expectations|
|
61
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
62
|
+
# and `failure_message` of custom matchers include text for helper methods
|
63
|
+
# defined using `chain`, e.g.:
|
64
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
65
|
+
# # => "be bigger than 2 and smaller than 4"
|
66
|
+
# ...rather than:
|
67
|
+
# # => "be bigger than 2"
|
68
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
69
|
+
end
|
70
|
+
|
71
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
72
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
73
|
+
config.mock_with :rspec do |mocks|
|
74
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
75
|
+
# a real object. This is generally recommended, and will default to
|
76
|
+
# `true` in RSpec 4.
|
77
|
+
mocks.verify_partial_doubles = true
|
78
|
+
end
|
79
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal.com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James C Russell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|
@@ -35,8 +35,11 @@ files:
|
|
35
35
|
- bin/terminal.com
|
36
36
|
- docs/help.txt
|
37
37
|
- lib/terminal.com.rb
|
38
|
+
- lib/terminal.com/api.rb
|
39
|
+
- spec/low-level/browse_snapshots_and_users_spec.rb
|
40
|
+
- spec/low-level/create_and_manage_terminals_spec.rb
|
41
|
+
- spec/low-level/terminal.com_spec.rb
|
38
42
|
- spec/spec_helper.rb
|
39
|
-
- spec/terminal.com_spec.rb
|
40
43
|
homepage: http://github.com/botanicus/terminal.com
|
41
44
|
licenses:
|
42
45
|
- MIT
|
@@ -47,9 +50,9 @@ require_paths:
|
|
47
50
|
- lib
|
48
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
52
|
requirements:
|
50
|
-
- - "
|
53
|
+
- - "~>"
|
51
54
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
55
|
+
version: '2'
|
53
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
57
|
requirements:
|
55
58
|
- - ">="
|
@@ -62,3 +65,4 @@ signing_key:
|
|
62
65
|
specification_version: 4
|
63
66
|
summary: The official Terminal.com Ruby + CLI client
|
64
67
|
test_files: []
|
68
|
+
has_rdoc:
|
data/spec/terminal.com_spec.rb
DELETED
File without changes
|