mio-config 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. metadata +13 -72
  3. data/#mio-config.gemspec# +0 -23
  4. data/Gemfile +0 -16
  5. data/Gemfile.lock +0 -68
  6. data/LICENCE.md +0 -8
  7. data/Rakefile +0 -7
  8. data/circle.yml +0 -3
  9. data/config/mio.yml +0 -4
  10. data/coverage/assets/0.10.0/application.css +0 -799
  11. data/coverage/assets/0.10.0/application.js +0 -1707
  12. data/coverage/assets/0.10.0/colorbox/border.png +0 -0
  13. data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
  14. data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
  15. data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
  16. data/coverage/assets/0.10.0/favicon_green.png +0 -0
  17. data/coverage/assets/0.10.0/favicon_red.png +0 -0
  18. data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
  19. data/coverage/assets/0.10.0/loading.gif +0 -0
  20. data/coverage/assets/0.10.0/magnify.png +0 -0
  21. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  22. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  23. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  24. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  25. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  26. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  27. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  28. data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  29. data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  30. data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  31. data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  32. data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  33. data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  34. data/coverage/index.html +0 -4884
  35. data/lib/mio/#model.rb# +0 -130
  36. data/migrations/20160429130853_create-an-s3-bucket-for-ingestion.rb +0 -11
  37. data/mio-config-1.3.0.gem +0 -0
  38. data/mio-config.gemspec +0 -24
  39. data/spec/factories/client_factories.rb +0 -41
  40. data/spec/factories/mio_factories.rb +0 -9
  41. data/spec/factories/model_factories.rb +0 -128
  42. data/spec/fixtures/vcr_cassettes/client.yml +0 -2415
  43. data/spec/fixtures/vcr_cassettes/client.yml~ +0 -2141
  44. data/spec/lib/mio/client_spec.rb +0 -79
  45. data/spec/lib/mio/config_spec.rb +0 -11
  46. data/spec/lib/mio/model/groovy_script_spec.rb +0 -13
  47. data/spec/lib/mio/model/groovy_script_wait_spec.rb +0 -13
  48. data/spec/lib/mio/model/hotfolder_spec.rb +0 -13
  49. data/spec/lib/mio/model/import_action_spec.rb +0 -13
  50. data/spec/lib/mio/model/s3_spec.rb +0 -13
  51. data/spec/lib/mio/model/workflow/node_spec.rb +0 -35
  52. data/spec/lib/mio/model/workflow/transition_spec.rb +0 -12
  53. data/spec/lib/mio/model/workflow_spec.rb +0 -38
  54. data/spec/lib/mio/search_spec.rb +0 -37
  55. data/spec/lib/mio_spec.rb +0 -30
  56. data/spec/spec_helper.rb +0 -16
  57. data/spec/support/factory_girl.rb +0 -3
  58. data/spec/support/shared_examples_for_client.rb +0 -27
  59. data/spec/support/shared_examples_for_model.rb +0 -87
  60. data/spec/support/vcr.rb +0 -12
@@ -1,79 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Client' do
4
- let(:mio_client){build :valid_client}
5
- let(:mio_client_invalid_user){build :invalid_user_client}
6
- let(:mio_client_invalid){build :invalid_client}
7
-
8
- let(:create_payload){build(:create_json).to_h}
9
- let(:configure_payload){ {'vfs-location' => build(:configure_json).to_h} }
10
- let(:action_payload){build(:action_json).to_h}
11
-
12
- context 'with correct credentials' do
13
- let(:client){mio_client}
14
- it_behaves_like 'simple_client'
15
- it_behaves_like 'masteruser_masteruser_client'
16
-
17
- context 'when searching for a resource' do
18
- context 'with a valid resource' do
19
- let(:resource){'resources'}
20
-
21
- it '#find_all returns a Hashie::Mash' do
22
- expect(client.find_all(resource)).to be_a(Hash)
23
- end
24
- end
25
-
26
- context 'with an invalid resource' do
27
- let(:resource){'no-such-resource'}
28
-
29
- it '#find_all throws Mio::Client::LoadOfBollocks' do
30
- expect{ client.find_all('no-such-resource') }.to raise_error(Mio::Client::LoadOfBollocks)
31
- end
32
- end
33
- end
34
-
35
- context 'when creating a valid resource' do
36
- let(:resource){'resources'}
37
-
38
- it 'successfully creates a new resource' do
39
- expect(client.create(resource, create_payload)).to be_a(Hash)
40
- end
41
-
42
- it 'successfully configures a new resource' do
43
- expect(client.configure(resource, 11113, configure_payload)).to be_a(Hash)
44
- end
45
-
46
- it 'successfully enables a new resource' do
47
- expect(client.action(resource, 11113, action_payload)).to be_a(Hash)
48
- end
49
-
50
- end
51
-
52
- context 'when creating an invalid resource' do
53
- let(:resource){'no-such-resource'}
54
-
55
- it 'successfully creates a new resource' do
56
- expect{client.create(resource, create_payload)}.to raise_error(Mio::Client::LoadOfBollocks)
57
- end
58
-
59
- it 'successfully configures a new resource' do
60
- expect{client.configure(resource, 0, configure_payload)}.to raise_error(Mio::Client::LoadOfBollocks)
61
- end
62
-
63
- it 'successfully enables a new resource' do
64
- expect{client.action(resource, 0, action_payload)}.to raise_error(Mio::Client::LoadOfBollocks)
65
- end
66
-
67
- end
68
- end
69
-
70
- context 'with invalid credentials' do
71
- let(:client){mio_client}
72
- it_behaves_like 'simple_client'
73
- end
74
-
75
- context 'with an invalid @base_uri' do
76
- let(:client){mio_client}
77
- it_behaves_like 'simple_client'
78
- end
79
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mio::Config do
4
-
5
- let (:mio_config) {Mio::Config.new}
6
- context 'when instantiating' do
7
- it 'should create an instance of Mio::Config' do
8
- expect(mio_config).to be_instance_of(Mio::Config)
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::GroovyScript' do
4
- subject{ Mio::Model::GroovyScript}
5
- let(:model_args){build(:groovy_script)}
6
- let(:invalid_model_args){build(:groovy_script_invalid_data)}
7
- let(:extra_model_args){build(:groovy_script_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'model_with_config_hash'
11
- it_behaves_like 'non_nested_model'
12
-
13
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::GroovyScriptWait' do
4
- subject{ Mio::Model::GroovyScriptWait }
5
- let(:model_args){build(:groovy_script_wait)}
6
- let(:invalid_model_args){build(:groovy_script_wait_invalid_data)}
7
- let(:extra_model_args){build(:groovy_script_wait_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'model_with_config_hash'
11
- it_behaves_like 'non_nested_model'
12
-
13
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::Hotfolder' do
4
- subject{ Mio::Model::Hotfolder }
5
- let(:model_args){build(:hotfolder)}
6
- let(:invalid_model_args){build(:hotfolder_invalid_data)}
7
- let(:extra_model_args){build(:hotfolder_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'model_with_config_hash'
11
- it_behaves_like 'non_nested_model'
12
-
13
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::ImportAction' do
4
- subject{ Mio::Model::ImportAction }
5
- let(:model_args){build(:import_action)}
6
- let(:invalid_model_args){build(:import_action_invalid_data)}
7
- let(:extra_model_args){build(:import_action_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'model_with_config_hash'
11
- it_behaves_like 'non_nested_model'
12
-
13
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::S3' do
4
- subject{ Mio::Model::S3 }
5
- let(:model_args){build(:s3)}
6
- let(:invalid_model_args){build(:s3_invalid_data)}
7
- let(:extra_model_args){build(:s3_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'model_with_config_hash'
11
- it_behaves_like 'non_nested_model'
12
-
13
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::Workflow::Node' do
4
- subject{ Mio::Model::Workflow::Node }
5
- let(:model_args){build(:node)}
6
- let(:invalid_model_args){build(:node_invalid_data)}
7
- let(:extra_model_args){build(:node_extra_data)}
8
- let(:action_model_args){build(:action_node)}
9
-
10
- it_behaves_like 'generic_model'
11
- it_behaves_like 'nested_model'
12
-
13
- let(:client){build(:valid_client)}
14
- let(:node_object){subject.new(client, model_args)}
15
-
16
- it 'responds to #normalize_action' do
17
- expect(node_object).to respond_to(:normalize_action)
18
- end
19
-
20
- context 'when adding a node without an action' do
21
- let(:node_object){subject.new(client,build(:action_node))}
22
- let(:node_hash){node_object.create_hash}
23
-
24
- it 'creates a hash with an ACTION object' do
25
- expect(node_hash).to include(:action)
26
- end
27
-
28
- [:id, :name, :pluginClass].each do |k|
29
- it "creates an ACTION object with key #{k.to_s}" do
30
- expect(node_hash[:action]).to include(k)
31
- end
32
- end
33
- end
34
-
35
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::Workflow::Transition' do
4
- subject{ Mio::Model::Workflow::Transition }
5
- let(:model_args){build(:transition)}
6
- let(:invalid_model_args){build(:transition_invalid_data)}
7
- let(:extra_model_args){build(:transition_extra_data)}
8
-
9
- it_behaves_like 'generic_model'
10
- it_behaves_like 'nested_model'
11
-
12
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Model::Workflow' do
4
- subject{ Mio::Model::Workflow }
5
- let(:model_args){build(:workflow)}
6
- let(:invalid_model_args){build(:workflow_invalid_data)}
7
- let(:extra_model_args){build(:workflow_extra_data)}
8
-
9
- let(:empty_nodes){build(:workflow_empty_nodes)}
10
- let(:empty_transitions){build(:workflow_empty_transitions)}
11
-
12
- let(:client){build(:valid_client)}
13
-
14
- it_behaves_like 'generic_model'
15
- it_behaves_like 'non_nested_model'
16
-
17
- context 'when instantiated with invalid options' do
18
- %w{node transition}.each do |field|
19
- let(:workflow){subject.new(client, build( "workflow_empty_#{field}s".to_sym ))}
20
-
21
- context "when given an empty list of #{field}" do
22
- it 'should raise a Mio::Model::EmptyField error' do
23
- expect{workflow.go}.to raise_error(Mio::Model::EmptyField)
24
- end
25
- end
26
- end
27
- end
28
-
29
- context 'when instantiated with valid options' do
30
- let(:workflow){subject.new(client, model_args)}
31
- [:structure_hash, :transition_lookup, :set_node_layouts].each do |m|
32
- it "should respond to ##{m.to_s}" do
33
- expect(workflow).to respond_to(m)
34
- end
35
- end
36
- end
37
-
38
- end
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio::Search' do
4
- let(:client){build :valid_client}
5
- let(:searcher){Mio::Search.new(client)}
6
-
7
- context 'when instantiated' do
8
- it 'initialises correctly' do
9
- expect(searcher).not_to be_nil
10
- end
11
- end
12
-
13
- context 'delegating to #method_missing' do
14
- it 'dynamically responds to #find_something_by_field' do
15
- expect(searcher).to respond_to(:find_something_by_field)
16
- end
17
-
18
- it 'searches for resources by key correctly' do
19
- expect(searcher.find_resources_by_name('vcr resource storage')).to be_an(Array)
20
- end
21
-
22
- context 'when regular expressions misses' do
23
- it 'returns true correctly for registered methods' do
24
- expect(searcher).to respond_to(:all)
25
- end
26
-
27
- it 'returns false for unregistered methods' do
28
- expect(searcher).not_to respond_to(:i_am_a_fake_method)
29
- end
30
-
31
- it 'throws an error when calling an unregistered method' do
32
- expect{ searcher.i_am_a_fake_method }.to raise_error(NoMethodError)
33
- end
34
- end
35
-
36
- end
37
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Mio' do
4
- let(:mio){build :mio}
5
-
6
- context 'when instantiating with args' do
7
- it 'creates an object' do
8
- expect(mio).not_to be_nil
9
- end
10
- end
11
-
12
- context 'when instantiating with a block' do
13
- let(:mio){Mio.new{|m| m.base_uri='example.com'; m.username='x'; m.password='x'}}
14
- it 'creates an object' do
15
- expect(mio).not_to be_nil
16
- end
17
- end
18
-
19
- context 'when created' do
20
- let(:client){mio.client}
21
- it_behaves_like 'simple_client'
22
- it_behaves_like 'masteruser_masteruser_client'
23
-
24
- [:base_uri, :base_uri=, :username, :username=, :password, :password=, :client].each do |m|
25
- it "responds to ##{m.to_s}" do
26
- expect(mio).to respond_to(m)
27
- end
28
- end
29
- end
30
- end
@@ -1,16 +0,0 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'simplecov'
3
- SimpleCov.start do
4
- add_filter 'spec'
5
- end
6
-
7
- require 'factory_girl'
8
- require 'faker'
9
- require 'rspec'
10
- require 'vcr'
11
-
12
- require 'mio'
13
-
14
- %w{support factories}.each do |d|
15
- Dir["./spec/#{d}/**/*.rb"].sort.each { |f| require f}
16
- end
@@ -1,3 +0,0 @@
1
- RSpec.configure do |config|
2
- config.include FactoryGirl::Syntax::Methods
3
- end
@@ -1,27 +0,0 @@
1
- shared_examples 'simple_client' do
2
- it 'instantiates' do
3
- expect(client).not_to be_nil
4
- end
5
-
6
- it 'creates a faraday object' do
7
- expect(client.instance_variable_get(:@agent)).to be_a(Faraday::Connection)
8
- end
9
-
10
- [:find_all, :create, :configure, :action].each do |public_method|
11
- it "responds to ##{public_method}" do
12
- expect(client).to respond_to(public_method)
13
- end
14
- end
15
-
16
- [:get, :post, :put, :make_object, :path].each do |private_method|
17
- it "has, but doesn't respond to, private method ##{private_method}" do
18
- expect(client.private_methods).to include(private_method)
19
- end
20
- end
21
- end
22
-
23
- shared_examples 'masteruser_masteruser_client' do
24
- it 'configures basic auth correctly' do
25
- expect(client.instance_variable_get(:@agent).headers['Authorization']).to eql 'Basic bWFzdGVydXNlcjptYXN0ZXJ1c2Vy'
26
- end
27
- end
@@ -1,87 +0,0 @@
1
- shared_examples 'generic_model' do
2
- context 'when interrogating the class object' do
3
- [:set_resource, :field, :mappings, :fields, :fields=, :resource_name, :resource_name=].each do |m|
4
- it "responds to public method ##{m.to_s}" do
5
- expect(subject).to respond_to(m)
6
- end
7
- end
8
-
9
- it 'correctly loads self into mappings' do
10
- expect(subject.mappings.values).to include(subject)
11
- end
12
- end
13
-
14
- context 'when creating an object' do
15
- let(:client){build :valid_client}
16
- let(:valid_model){subject.new(client, model_args)}
17
-
18
- it 'instantiates' do
19
- expect(valid_model).not_to be_nil
20
- end
21
-
22
- [:create_hash].each do |m|
23
- it "provides a hash from ##{m}" do
24
- expect(valid_model.method(m).call).to be_an(Hash)
25
- end
26
- end
27
-
28
- context 'when validating configuration' do
29
- let(:empty_model){subject.new(client, {})}
30
- let(:bad_data){subject.new(client, invalid_model_args)}
31
- let(:extra_data){subject.new(client, extra_model_args)}
32
-
33
- it 'returns true for #valid? for valid configuration' do
34
- expect(valid_model.valid?).to be true
35
- end
36
-
37
- it 'throws Mio::Model::MissingField when configuration misses a required field' do
38
- expect{empty_model.valid?}.to raise_error(Mio::Model::MissingField)
39
- end
40
-
41
- it 'throws Mio::Model::DataTypeError when configuration contains a bad data type' do
42
- expect{bad_data.valid?}.to raise_error(Mio::Model::DataTypeError)
43
- end
44
-
45
- it 'throws Mio::Model::NoSuchField when configuration contains unexpected data' do
46
- expect{extra_data.valid?}.to raise_error(Mio::Model::NoSuchField)
47
- end
48
-
49
- end
50
- end
51
- end
52
-
53
- shared_examples 'model_with_config_hash' do
54
- let(:client){build :valid_client}
55
- let(:valid_model){subject.new(client, model_args)}
56
-
57
- [:config_hash].each do |m|
58
- it "provides a hash from ##{m}" do
59
- expect(valid_model.method(m).call).to be_an(Hash)
60
- end
61
- end
62
- end
63
-
64
- shared_examples 'nested_model' do
65
- let(:client){build :valid_client}
66
- let(:valid_model){subject.new(client, model_args)}
67
-
68
- it "returns true for #nested?" do
69
- expect(subject.nested?).to be(true)
70
- end
71
- end
72
-
73
- shared_examples 'non_nested_model' do
74
- let(:client){build :valid_client}
75
- let(:valid_model){subject.new(client, model_args)}
76
-
77
- it "returns false for #nested?" do
78
- expect(subject.nested?).to be(false)
79
- end
80
-
81
- context 'when creating a mio resource' do
82
- it 'Goes through the complete flow with #go' do
83
- expect(valid_model.go).to be_a(Hash)
84
- end
85
- end
86
-
87
- end