mavenlink 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +10 -3
- data/Gemfile.lock +38 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +69 -0
- data/Rakefile +50 -24
- data/TODO +18 -0
- data/VERSION +1 -0
- data/lib/mavenlink.rb +2 -134
- data/lib/mavenlink/base.rb +184 -0
- data/lib/mavenlink/client.rb +202 -96
- data/mavenlink.gemspec +85 -19
- data/spec/mavenlink/base_spec.rb +223 -0
- data/spec/mavenlink/client_spec.rb +183 -0
- data/spec/spec_helper.rb +13 -25
- metadata +243 -232
- checksums.yaml +0 -7
- data/.gitignore +0 -11
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/README.md +0 -241
- data/bin/mavenlink-console +0 -18
- data/doc/ml_logo_lb-primary.png +0 -0
- data/lib/config/specification.yml +0 -1665
- data/lib/mavenlink/account_invitation.rb +0 -4
- data/lib/mavenlink/account_membership.rb +0 -4
- data/lib/mavenlink/additional_item.rb +0 -4
- data/lib/mavenlink/assignment.rb +0 -5
- data/lib/mavenlink/attachment.rb +0 -11
- data/lib/mavenlink/backup_approver_association.rb +0 -4
- data/lib/mavenlink/concerns/custom_fieldable.rb +0 -9
- data/lib/mavenlink/concerns/indestructible.rb +0 -11
- data/lib/mavenlink/concerns/locked_record.rb +0 -30
- data/lib/mavenlink/cost_rate.rb +0 -4
- data/lib/mavenlink/custom_field.rb +0 -4
- data/lib/mavenlink/custom_field_choice.rb +0 -5
- data/lib/mavenlink/custom_field_value.rb +0 -4
- data/lib/mavenlink/errors.rb +0 -47
- data/lib/mavenlink/expense.rb +0 -4
- data/lib/mavenlink/expense_category.rb +0 -4
- data/lib/mavenlink/expense_report_submission.rb +0 -7
- data/lib/mavenlink/external_payment.rb +0 -4
- data/lib/mavenlink/external_reference.rb +0 -24
- data/lib/mavenlink/fixed_fee_item.rb +0 -4
- data/lib/mavenlink/holiday.rb +0 -4
- data/lib/mavenlink/holiday_calendar.rb +0 -4
- data/lib/mavenlink/holiday_calendar_association.rb +0 -4
- data/lib/mavenlink/holiday_calendar_membership.rb +0 -4
- data/lib/mavenlink/invoice.rb +0 -4
- data/lib/mavenlink/logger.rb +0 -62
- data/lib/mavenlink/model.rb +0 -279
- data/lib/mavenlink/organization.rb +0 -4
- data/lib/mavenlink/organization_membership.rb +0 -4
- data/lib/mavenlink/participation.rb +0 -4
- data/lib/mavenlink/post.rb +0 -4
- data/lib/mavenlink/project_template.rb +0 -4
- data/lib/mavenlink/project_template_assignment.rb +0 -4
- data/lib/mavenlink/railtie.rb +0 -7
- data/lib/mavenlink/rate_card.rb +0 -4
- data/lib/mavenlink/rate_card_role.rb +0 -4
- data/lib/mavenlink/rate_card_set.rb +0 -4
- data/lib/mavenlink/rate_card_set_version.rb +0 -30
- data/lib/mavenlink/rate_card_version.rb +0 -4
- data/lib/mavenlink/request.rb +0 -241
- data/lib/mavenlink/resolution.rb +0 -4
- data/lib/mavenlink/response.rb +0 -22
- data/lib/mavenlink/role.rb +0 -5
- data/lib/mavenlink/settings.rb +0 -11
- data/lib/mavenlink/skill.rb +0 -4
- data/lib/mavenlink/skill_category.rb +0 -4
- data/lib/mavenlink/skill_membership.rb +0 -4
- data/lib/mavenlink/specificators/association.rb +0 -13
- data/lib/mavenlink/specificators/attribute.rb +0 -13
- data/lib/mavenlink/specificators/base.rb +0 -24
- data/lib/mavenlink/specificators/validation.rb +0 -27
- data/lib/mavenlink/status_report.rb +0 -4
- data/lib/mavenlink/story.rb +0 -8
- data/lib/mavenlink/story_allocation_day.rb +0 -5
- data/lib/mavenlink/story_dependency.rb +0 -5
- data/lib/mavenlink/story_task.rb +0 -5
- data/lib/mavenlink/tag.rb +0 -5
- data/lib/mavenlink/time_adjustment.rb +0 -4
- data/lib/mavenlink/time_entry.rb +0 -4
- data/lib/mavenlink/time_off_entry.rb +0 -4
- data/lib/mavenlink/timesheet_submission.rb +0 -4
- data/lib/mavenlink/user.rb +0 -5
- data/lib/mavenlink/vendor.rb +0 -4
- data/lib/mavenlink/workspace.rb +0 -21
- data/lib/mavenlink/workspace_group.rb +0 -5
- data/lib/mavenlink/workspace_invoice_preference.rb +0 -4
- data/lib/mavenlink/workweek.rb +0 -4
- data/lib/mavenlink/workweek_membership.rb +0 -4
- data/spec/lib/mavenlink/account_membership_spec.rb +0 -8
- data/spec/lib/mavenlink/assignment_spec.rb +0 -17
- data/spec/lib/mavenlink/attachment_spec.rb +0 -30
- data/spec/lib/mavenlink/backup_approver_association_spec.rb +0 -9
- data/spec/lib/mavenlink/client_spec.rb +0 -187
- data/spec/lib/mavenlink/concerns/indestructible_spec.rb +0 -13
- data/spec/lib/mavenlink/concerns/locked_record_spec.rb +0 -28
- data/spec/lib/mavenlink/cost_rate_spec.rb +0 -9
- data/spec/lib/mavenlink/custom_field_value_spec.rb +0 -10
- data/spec/lib/mavenlink/expense_report_submission_spec.rb +0 -16
- data/spec/lib/mavenlink/expense_spec.rb +0 -23
- data/spec/lib/mavenlink/external_references_spec.rb +0 -144
- data/spec/lib/mavenlink/holiday_calendar_association_spec.rb +0 -8
- data/spec/lib/mavenlink/holiday_calendar_membership_spec.rb +0 -8
- data/spec/lib/mavenlink/holiday_spec.rb +0 -7
- data/spec/lib/mavenlink/invalid_request_error_spec.rb +0 -9
- data/spec/lib/mavenlink/invoice_spec.rb +0 -176
- data/spec/lib/mavenlink/model_spec.rb +0 -439
- data/spec/lib/mavenlink/post_spec.rb +0 -23
- data/spec/lib/mavenlink/rate_card_set_version_spec.rb +0 -119
- data/spec/lib/mavenlink/record_invalid_error_spec.rb +0 -16
- data/spec/lib/mavenlink/record_not_found_error_spec.rb +0 -9
- data/spec/lib/mavenlink/request_spec.rb +0 -381
- data/spec/lib/mavenlink/response_spec.rb +0 -50
- data/spec/lib/mavenlink/role_spec.rb +0 -9
- data/spec/lib/mavenlink/settings_spec.rb +0 -23
- data/spec/lib/mavenlink/skill_category_spec.rb +0 -7
- data/spec/lib/mavenlink/skill_membership_spec.rb +0 -9
- data/spec/lib/mavenlink/skill_spec.rb +0 -8
- data/spec/lib/mavenlink/specificators/association_spec.rb +0 -25
- data/spec/lib/mavenlink/specificators/attribute_spec.rb +0 -25
- data/spec/lib/mavenlink/specificators/validation_spec.rb +0 -39
- data/spec/lib/mavenlink/story_allocation_day_spec.rb +0 -64
- data/spec/lib/mavenlink/story_dependency_spec.rb +0 -16
- data/spec/lib/mavenlink/story_spec.rb +0 -69
- data/spec/lib/mavenlink/time_adjustment_spec.rb +0 -13
- data/spec/lib/mavenlink/time_entry_spec.rb +0 -43
- data/spec/lib/mavenlink/time_off_entry_spec.rb +0 -9
- data/spec/lib/mavenlink/user_spec.rb +0 -138
- data/spec/lib/mavenlink/workspace_group_spec.rb +0 -25
- data/spec/lib/mavenlink/workspace_spec.rb +0 -431
- data/spec/lib/mavenlink_spec.rb +0 -43
- data/spec/support/shared_examples.rb +0 -148
data/spec/lib/mavenlink_spec.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mavenlink do
|
4
|
-
subject { described_class }
|
5
|
-
|
6
|
-
its(:adapter) { should_not be_nil }
|
7
|
-
its(:client) { should_not be_nil }
|
8
|
-
its(:default_settings) { should be_a Hash }
|
9
|
-
its(:logger) { should be_a Logger }
|
10
|
-
its(:specification) { should be_a BrainstemAdaptor::Specification }
|
11
|
-
|
12
|
-
describe '.adapter=' do
|
13
|
-
let(:adapter) { double('adapter') }
|
14
|
-
|
15
|
-
specify do
|
16
|
-
expect { Mavenlink.adapter = adapter }.to change(Mavenlink, :adapter).to(adapter)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.logger=' do
|
21
|
-
let(:logger) { double('logger') }
|
22
|
-
|
23
|
-
specify do
|
24
|
-
expect { Mavenlink.logger = logger }.to change(Mavenlink, :logger).to(logger)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.oauth_token=' do
|
29
|
-
specify do
|
30
|
-
expect { Mavenlink.oauth_token = 'new token' }.to change { Mavenlink::Settings[:default][:oauth_token] }.from('token').to('new token')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '.perform_validations=' do
|
35
|
-
before do
|
36
|
-
Mavenlink.perform_validations = false
|
37
|
-
end
|
38
|
-
|
39
|
-
specify do
|
40
|
-
expect { Mavenlink.perform_validations = true }.to change { Mavenlink::Settings[:default][:perform_validations] }.to(true)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
shared_context 'model' do |collection_name|
|
2
|
-
let(:model) { described_class }
|
3
|
-
|
4
|
-
let(:response) {
|
5
|
-
{
|
6
|
-
'count' => 1,
|
7
|
-
'results' => [{'key' => collection_name, 'id' => '7'}],
|
8
|
-
collection_name => {
|
9
|
-
'7' => {'title' => 'My new record', 'id' => '7'}
|
10
|
-
}
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
before do
|
15
|
-
stub_request :get, "/api/v1/#{collection_name}?only=7", response
|
16
|
-
stub_request :get, "/api/v1/#{collection_name}?only=8", {'count' => 0, 'results' => []}
|
17
|
-
stub_request :post, "/api/v1/#{collection_name}", response
|
18
|
-
stub_request :delete, "/api/v1/#{collection_name}/4", {'count' => 0, 'results' => []} # TODO: replace with real one
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'class methods' do
|
22
|
-
subject { model }
|
23
|
-
its(:collection_name) { should == collection_name }
|
24
|
-
|
25
|
-
describe '.scoped' do
|
26
|
-
subject { model.scoped }
|
27
|
-
|
28
|
-
it { should be_a Mavenlink::Request }
|
29
|
-
its(:collection_name) { should == collection_name }
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '.find' do
|
33
|
-
specify do
|
34
|
-
expect(model.find(7)).to be_a model
|
35
|
-
end
|
36
|
-
|
37
|
-
specify do
|
38
|
-
expect(model.find(7).id).to eq('7')
|
39
|
-
end
|
40
|
-
|
41
|
-
specify do
|
42
|
-
expect(model.find(8)).to be_nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '.models' do
|
47
|
-
specify do
|
48
|
-
expect(model.models).to be_empty
|
49
|
-
end
|
50
|
-
|
51
|
-
specify do
|
52
|
-
expect(Mavenlink::Model.models).to include({collection_name => model})
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '.specification' do
|
57
|
-
specify do
|
58
|
-
expect(model.specification).to be_a Hash
|
59
|
-
end
|
60
|
-
|
61
|
-
specify do
|
62
|
-
expect(model.specification).not_to be_empty
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '.attributes' do
|
67
|
-
specify do
|
68
|
-
expect(model.attributes).to be_an Array
|
69
|
-
end
|
70
|
-
|
71
|
-
specify do
|
72
|
-
expect(model.attributes).not_to be_empty
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '.available_attributes' do
|
77
|
-
specify do
|
78
|
-
expect(model.available_attributes).to be_an Array
|
79
|
-
end
|
80
|
-
|
81
|
-
specify do
|
82
|
-
expect(model.available_attributes).not_to be_empty
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '.create_attributes' do
|
87
|
-
specify do
|
88
|
-
expect(model.create_attributes).to be_an Array
|
89
|
-
end
|
90
|
-
|
91
|
-
specify do
|
92
|
-
expect(model.create_attributes).not_to be_empty
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '.update_attributes' do
|
97
|
-
specify do
|
98
|
-
expect(model.update_attributes).to be_an Array
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe '.wrap' do
|
103
|
-
specify do
|
104
|
-
expect(model.wrap(nil)).to be_a_new_record
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'existing record' do
|
108
|
-
let(:brainstem_record) do
|
109
|
-
BrainstemAdaptor::Record.new(collection_name, '7', Mavenlink::Response.new(response))
|
110
|
-
end
|
111
|
-
|
112
|
-
specify do
|
113
|
-
expect(model.wrap(brainstem_record)).not_to be_a_new_record
|
114
|
-
end
|
115
|
-
|
116
|
-
specify do
|
117
|
-
expect(model.wrap(brainstem_record)).to be_a model
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe '#initialize' do
|
124
|
-
it 'accepts attributes' do
|
125
|
-
expect(model.new(any_custom_key: 'value set')).to include(any_custom_key: 'value set')
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe '#persisted?' do
|
130
|
-
specify do
|
131
|
-
expect(model.new).not_to be_persisted
|
132
|
-
end
|
133
|
-
|
134
|
-
specify do
|
135
|
-
expect(model.new(id: 1)).to be_persisted
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '#new_record?' do
|
140
|
-
specify do
|
141
|
-
expect(model.new).to be_new_record
|
142
|
-
end
|
143
|
-
|
144
|
-
specify do
|
145
|
-
expect(model.new(id: 1)).not_to be_new_record
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|