mavenlink 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +10 -3
  4. data/Gemfile.lock +38 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +69 -0
  7. data/Rakefile +50 -24
  8. data/TODO +18 -0
  9. data/VERSION +1 -0
  10. data/lib/mavenlink.rb +2 -134
  11. data/lib/mavenlink/base.rb +184 -0
  12. data/lib/mavenlink/client.rb +202 -96
  13. data/mavenlink.gemspec +85 -19
  14. data/spec/mavenlink/base_spec.rb +223 -0
  15. data/spec/mavenlink/client_spec.rb +183 -0
  16. data/spec/spec_helper.rb +13 -25
  17. metadata +243 -232
  18. checksums.yaml +0 -7
  19. data/.gitignore +0 -11
  20. data/.ruby-gemset +0 -1
  21. data/.ruby-version +0 -1
  22. data/README.md +0 -241
  23. data/bin/mavenlink-console +0 -18
  24. data/doc/ml_logo_lb-primary.png +0 -0
  25. data/lib/config/specification.yml +0 -1665
  26. data/lib/mavenlink/account_invitation.rb +0 -4
  27. data/lib/mavenlink/account_membership.rb +0 -4
  28. data/lib/mavenlink/additional_item.rb +0 -4
  29. data/lib/mavenlink/assignment.rb +0 -5
  30. data/lib/mavenlink/attachment.rb +0 -11
  31. data/lib/mavenlink/backup_approver_association.rb +0 -4
  32. data/lib/mavenlink/concerns/custom_fieldable.rb +0 -9
  33. data/lib/mavenlink/concerns/indestructible.rb +0 -11
  34. data/lib/mavenlink/concerns/locked_record.rb +0 -30
  35. data/lib/mavenlink/cost_rate.rb +0 -4
  36. data/lib/mavenlink/custom_field.rb +0 -4
  37. data/lib/mavenlink/custom_field_choice.rb +0 -5
  38. data/lib/mavenlink/custom_field_value.rb +0 -4
  39. data/lib/mavenlink/errors.rb +0 -47
  40. data/lib/mavenlink/expense.rb +0 -4
  41. data/lib/mavenlink/expense_category.rb +0 -4
  42. data/lib/mavenlink/expense_report_submission.rb +0 -7
  43. data/lib/mavenlink/external_payment.rb +0 -4
  44. data/lib/mavenlink/external_reference.rb +0 -24
  45. data/lib/mavenlink/fixed_fee_item.rb +0 -4
  46. data/lib/mavenlink/holiday.rb +0 -4
  47. data/lib/mavenlink/holiday_calendar.rb +0 -4
  48. data/lib/mavenlink/holiday_calendar_association.rb +0 -4
  49. data/lib/mavenlink/holiday_calendar_membership.rb +0 -4
  50. data/lib/mavenlink/invoice.rb +0 -4
  51. data/lib/mavenlink/logger.rb +0 -62
  52. data/lib/mavenlink/model.rb +0 -279
  53. data/lib/mavenlink/organization.rb +0 -4
  54. data/lib/mavenlink/organization_membership.rb +0 -4
  55. data/lib/mavenlink/participation.rb +0 -4
  56. data/lib/mavenlink/post.rb +0 -4
  57. data/lib/mavenlink/project_template.rb +0 -4
  58. data/lib/mavenlink/project_template_assignment.rb +0 -4
  59. data/lib/mavenlink/railtie.rb +0 -7
  60. data/lib/mavenlink/rate_card.rb +0 -4
  61. data/lib/mavenlink/rate_card_role.rb +0 -4
  62. data/lib/mavenlink/rate_card_set.rb +0 -4
  63. data/lib/mavenlink/rate_card_set_version.rb +0 -30
  64. data/lib/mavenlink/rate_card_version.rb +0 -4
  65. data/lib/mavenlink/request.rb +0 -241
  66. data/lib/mavenlink/resolution.rb +0 -4
  67. data/lib/mavenlink/response.rb +0 -22
  68. data/lib/mavenlink/role.rb +0 -5
  69. data/lib/mavenlink/settings.rb +0 -11
  70. data/lib/mavenlink/skill.rb +0 -4
  71. data/lib/mavenlink/skill_category.rb +0 -4
  72. data/lib/mavenlink/skill_membership.rb +0 -4
  73. data/lib/mavenlink/specificators/association.rb +0 -13
  74. data/lib/mavenlink/specificators/attribute.rb +0 -13
  75. data/lib/mavenlink/specificators/base.rb +0 -24
  76. data/lib/mavenlink/specificators/validation.rb +0 -27
  77. data/lib/mavenlink/status_report.rb +0 -4
  78. data/lib/mavenlink/story.rb +0 -8
  79. data/lib/mavenlink/story_allocation_day.rb +0 -5
  80. data/lib/mavenlink/story_dependency.rb +0 -5
  81. data/lib/mavenlink/story_task.rb +0 -5
  82. data/lib/mavenlink/tag.rb +0 -5
  83. data/lib/mavenlink/time_adjustment.rb +0 -4
  84. data/lib/mavenlink/time_entry.rb +0 -4
  85. data/lib/mavenlink/time_off_entry.rb +0 -4
  86. data/lib/mavenlink/timesheet_submission.rb +0 -4
  87. data/lib/mavenlink/user.rb +0 -5
  88. data/lib/mavenlink/vendor.rb +0 -4
  89. data/lib/mavenlink/workspace.rb +0 -21
  90. data/lib/mavenlink/workspace_group.rb +0 -5
  91. data/lib/mavenlink/workspace_invoice_preference.rb +0 -4
  92. data/lib/mavenlink/workweek.rb +0 -4
  93. data/lib/mavenlink/workweek_membership.rb +0 -4
  94. data/spec/lib/mavenlink/account_membership_spec.rb +0 -8
  95. data/spec/lib/mavenlink/assignment_spec.rb +0 -17
  96. data/spec/lib/mavenlink/attachment_spec.rb +0 -30
  97. data/spec/lib/mavenlink/backup_approver_association_spec.rb +0 -9
  98. data/spec/lib/mavenlink/client_spec.rb +0 -187
  99. data/spec/lib/mavenlink/concerns/indestructible_spec.rb +0 -13
  100. data/spec/lib/mavenlink/concerns/locked_record_spec.rb +0 -28
  101. data/spec/lib/mavenlink/cost_rate_spec.rb +0 -9
  102. data/spec/lib/mavenlink/custom_field_value_spec.rb +0 -10
  103. data/spec/lib/mavenlink/expense_report_submission_spec.rb +0 -16
  104. data/spec/lib/mavenlink/expense_spec.rb +0 -23
  105. data/spec/lib/mavenlink/external_references_spec.rb +0 -144
  106. data/spec/lib/mavenlink/holiday_calendar_association_spec.rb +0 -8
  107. data/spec/lib/mavenlink/holiday_calendar_membership_spec.rb +0 -8
  108. data/spec/lib/mavenlink/holiday_spec.rb +0 -7
  109. data/spec/lib/mavenlink/invalid_request_error_spec.rb +0 -9
  110. data/spec/lib/mavenlink/invoice_spec.rb +0 -176
  111. data/spec/lib/mavenlink/model_spec.rb +0 -439
  112. data/spec/lib/mavenlink/post_spec.rb +0 -23
  113. data/spec/lib/mavenlink/rate_card_set_version_spec.rb +0 -119
  114. data/spec/lib/mavenlink/record_invalid_error_spec.rb +0 -16
  115. data/spec/lib/mavenlink/record_not_found_error_spec.rb +0 -9
  116. data/spec/lib/mavenlink/request_spec.rb +0 -381
  117. data/spec/lib/mavenlink/response_spec.rb +0 -50
  118. data/spec/lib/mavenlink/role_spec.rb +0 -9
  119. data/spec/lib/mavenlink/settings_spec.rb +0 -23
  120. data/spec/lib/mavenlink/skill_category_spec.rb +0 -7
  121. data/spec/lib/mavenlink/skill_membership_spec.rb +0 -9
  122. data/spec/lib/mavenlink/skill_spec.rb +0 -8
  123. data/spec/lib/mavenlink/specificators/association_spec.rb +0 -25
  124. data/spec/lib/mavenlink/specificators/attribute_spec.rb +0 -25
  125. data/spec/lib/mavenlink/specificators/validation_spec.rb +0 -39
  126. data/spec/lib/mavenlink/story_allocation_day_spec.rb +0 -64
  127. data/spec/lib/mavenlink/story_dependency_spec.rb +0 -16
  128. data/spec/lib/mavenlink/story_spec.rb +0 -69
  129. data/spec/lib/mavenlink/time_adjustment_spec.rb +0 -13
  130. data/spec/lib/mavenlink/time_entry_spec.rb +0 -43
  131. data/spec/lib/mavenlink/time_off_entry_spec.rb +0 -9
  132. data/spec/lib/mavenlink/user_spec.rb +0 -138
  133. data/spec/lib/mavenlink/workspace_group_spec.rb +0 -25
  134. data/spec/lib/mavenlink/workspace_spec.rb +0 -431
  135. data/spec/lib/mavenlink_spec.rb +0 -43
  136. data/spec/support/shared_examples.rb +0 -148
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Response, stub_requests: true do
4
- let(:response_data) {
5
- {
6
- 'count' => 2,
7
- 'results' => [{'key' => 'workspaces', 'id' => '7'}, {'key' => 'users', 'id' => '9'}],
8
- 'workspaces' => {
9
- '7' => {'title' => 'My new project'},
10
- '9' => {'title' => 'My second project'},
11
- },
12
- 'users' => {
13
- '1' => {'title' => 'My second project'},
14
- '9' => {'title' => 'My new project'},
15
- }
16
- }
17
- }
18
-
19
- subject(:response) { described_class.new(response_data) }
20
-
21
- describe '#results' do
22
- specify do
23
- expect(response.results).to have(2).records
24
- end
25
-
26
- it 'checks for client' do
27
- expect(response).to respond_to (:client)
28
- expect(response.client).to be_a Mavenlink::Client
29
- end
30
-
31
- it 'returns records in a proper order' do
32
- expect(response.results[0]).to be_a Mavenlink::Workspace
33
- expect(response.results[1]).to be_a Mavenlink::User
34
- end
35
-
36
- end
37
-
38
- describe '#client' do
39
- specify 'default client' do
40
- expect(response.client).to be_a Mavenlink::Client
41
- end
42
-
43
- context 'custom client set' do
44
- let(:client) { Mavenlink::Client.new(oauth_token: 'new one') }
45
- subject(:response) { described_class.new(response_data, client) }
46
-
47
- its(:client) { should eq(client) }
48
- end
49
- end
50
- end
@@ -1,9 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::Role, stub_requests: true do
4
- it_should_behave_like 'model', 'roles'
5
-
6
- describe 'validations' do
7
- it { should validate_presence_of :name }
8
- end
9
- end
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Settings do
4
- describe '.[]' do
5
- before do
6
- described_class[:new_for_test][:config_var] = 'config value'
7
- end
8
-
9
- it 'stores settings' do
10
- expect(described_class[:new_for_test][:config_var]).to eq('config value')
11
- end
12
-
13
- it 'does not override other namespaces' do
14
- expect(described_class[:another_for_test][:config_var]).to be_nil
15
- end
16
-
17
- describe 'default values' do
18
- it 'does not force framework to perform any validations' do
19
- expect(described_class[:checking_default_value][:perform_validations]).to eq(false)
20
- end
21
- end
22
- end
23
- end
@@ -1,7 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::SkillCategory do
4
- describe "associations" do
5
- it { should respond_to :skills }
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::SkillMembership do
4
- describe "associations" do
5
- it { should respond_to :skill }
6
- it { should respond_to :user }
7
- it { should respond_to :creator }
8
- end
9
- end
@@ -1,8 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::Skill do
4
- describe "associations" do
5
- it { should respond_to :skill_category }
6
- it { should respond_to :roles }
7
- end
8
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Specificators::Association do
4
- subject { model.new }
5
-
6
- before { described_class.apply(model) }
7
-
8
- let(:model) do
9
- Class.new Mavenlink::Model do
10
- def self.specification
11
- {'associations' => {'children' => {}, 'parents' => {}}}
12
- end
13
- end
14
- end
15
-
16
- it { should respond_to :children }
17
- it { should respond_to :parents }
18
-
19
- describe 'real model' do
20
- subject { Mavenlink::Workspace.new }
21
-
22
- it { should respond_to :primary_counterpart }
23
- it { should respond_to :participants }
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Specificators::Attribute do
4
- subject { model.new }
5
-
6
- before { described_class.apply(model) }
7
-
8
- let(:model) do
9
- Class.new Mavenlink::Model do
10
- def self.available_attributes
11
- %w(one two)
12
- end
13
- end
14
- end
15
-
16
- it { should respond_to :one }
17
- it { should respond_to :two }
18
-
19
- describe 'real model' do
20
- subject { Mavenlink::Workspace.new }
21
-
22
- it { should respond_to :title }
23
- it { should respond_to :description }
24
- end
25
- end
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Specificators::Validation do
4
- subject { model.new }
5
-
6
- before { described_class.apply(model) }
7
-
8
- let(:model) do
9
- Class.new Mavenlink::Model do
10
- attr_accessor :name
11
-
12
- def self.specification
13
- {'validations' => {'name' => {'presence' => true}}}
14
- end
15
-
16
- def self.model_name
17
- ActiveModel::Name.new(self, nil, 'temp')
18
- end
19
- end
20
- end
21
-
22
- it { should validate_presence_of :name }
23
-
24
- describe 'real model' do
25
- let(:client) { Object.new }
26
-
27
- context 'new record' do
28
- subject { Mavenlink::Workspace.new({}, nil, client) }
29
-
30
- it { should validate_presence_of :title }
31
- end
32
-
33
- context 'persisted record' do
34
- subject { Mavenlink::Workspace.new({ id: 12 }, nil, client) }
35
-
36
- it { should validate_presence_of :title }
37
- end
38
- end
39
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::StoryAllocationDay, stub_requests: true do
4
- it_should_behave_like 'model', 'story_allocation_days'
5
-
6
- describe 'validations' do
7
- it { should validate_presence_of :assignment_id }
8
- it { should validate_presence_of :date }
9
- it { should validate_presence_of :minutes }
10
- end
11
-
12
- describe 'associations' do
13
- it { should respond_to :assignment }
14
- it { should respond_to :story }
15
- it { should respond_to :workspace }
16
- end
17
-
18
- let(:response) {
19
- {
20
- 'count' => 1,
21
- 'results' => [{'key' => 'story_allocation_days', 'id' => '7'}],
22
- 'story_allocation_days' => {
23
- '7' => {'current' => true, 'id' => '7'}
24
- }
25
- }
26
- }
27
-
28
- before do
29
- stub_request :get, "/api/v1/story_allocation_days?only=7", response
30
- stub_request :get, "/api/v1/story_allocation_days?only=8", {'count' => 0, 'results' => []}
31
- stub_request :post, "/api/v1/story_allocation_days", response
32
- stub_request :delete, "/api/v1/story_allocation_days/4", {}
33
- end
34
-
35
- describe '#save' do
36
- context 'new record' do
37
- subject { described_class.new }
38
-
39
- context 'invalid record' do
40
- specify do
41
- expect(subject.save).to be_false
42
- end
43
- end
44
-
45
- context 'valid record' do
46
- subject { described_class.new(assignment_id: '1', date: 'today', minutes: '0', current: false) }
47
-
48
- specify do
49
- expect(subject.save).to be_true
50
- end
51
-
52
- it 'reloads record fields taking it from response' do
53
- expect { subject.save }.to change { subject.current }.from(false).to(true)
54
- end
55
- end
56
- end
57
- end
58
-
59
- describe '#destroy' do
60
- specify do
61
- expect(described_class.new(id: '4').destroy).to be_blank
62
- end
63
- end
64
- end
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::StoryDependency, stub_requests: true do
4
- it_should_behave_like 'model', 'story_dependencies'
5
-
6
- describe 'associations' do
7
- it { should respond_to :source }
8
- it { should respond_to :target }
9
- end
10
-
11
- describe 'validations' do
12
- it { should validate_presence_of :source_id }
13
- it { should validate_presence_of :target_id }
14
- it { should validate_presence_of(:workspace_id).on(:create) }
15
- end
16
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::Story, stub_requests: true do
4
- it_should_behave_like 'model', 'stories'
5
-
6
- describe 'validations' do
7
- it { should validate_presence_of :title }
8
- it { should validate_presence_of :story_type }
9
- it { should validate_presence_of :workspace_id }
10
- it { should ensure_inclusion_of(:story_type).in_array(%w(task deliverable milestone)) }
11
- end
12
-
13
- describe 'associations' do
14
- it { should respond_to :workspace }
15
- it { should respond_to :parent }
16
- it { should respond_to :assignees }
17
- it { should respond_to :sub_stories }
18
- it { should respond_to :descendants }
19
- it { should respond_to :custom_field_values }
20
- it { should respond_to :external_references }
21
- end
22
-
23
- let(:response) {
24
- {
25
- 'count' => 1,
26
- 'results' => [{'key' => 'stories', 'id' => '7'}],
27
- 'stories' => {
28
- '7' => {'title' => 'My new record', 'id' => '7'}
29
- }
30
- }
31
- }
32
-
33
- before do
34
- stub_request :get, "/api/v1/stories?only=7", response
35
- stub_request :get, "/api/v1/stories?only=8", {'count' => 0, 'results' => []}
36
- stub_request :post, "/api/v1/stories", response
37
- stub_request :delete, "/api/v1/stories/4", {}
38
- end
39
-
40
- describe '#save' do
41
- context 'new record' do
42
- subject { described_class.new }
43
-
44
- context 'invalid record' do
45
- specify do
46
- expect(subject.save).to be_false
47
- end
48
- end
49
-
50
- context 'valid record' do
51
- subject { described_class.new(title: 'the record', story_type: 'task', workspace_id: '1') }
52
-
53
- specify do
54
- expect(subject.save).to be_true
55
- end
56
-
57
- it 'reloads record fields taking it from response' do
58
- expect { subject.save }.to change { subject.title }.from('the record').to('My new record')
59
- end
60
- end
61
- end
62
- end
63
-
64
- describe '#destroy' do
65
- specify do
66
- expect(described_class.new(id: '4').destroy).to be_blank
67
- end
68
- end
69
- end
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::TimeAdjustment, stub_requests: true do
4
- it_should_behave_like "model", "time_adjustments"
5
-
6
- describe "associations" do
7
- it { should respond_to :story }
8
- it { should respond_to :workspace }
9
- it { should respond_to :user }
10
- it { should respond_to :creator }
11
- it { should respond_to :active_invoice }
12
- end
13
- end
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::TimeEntry, stub_requests: true do
4
- it_should_behave_like 'model', 'time_entries'
5
-
6
- describe 'validations' do
7
- it { should validate_presence_of :workspace_id }
8
- it { should validate_presence_of :date_performed }
9
- it { should validate_presence_of :time_in_minutes }
10
- end
11
-
12
- describe 'associations' do
13
- it { should respond_to :workspace }
14
- it { should respond_to :user }
15
- it { should respond_to :story }
16
- end
17
-
18
- it 'should respond to expected attributes' do
19
- should respond_to(:created_at, :updated_at, :date_performed, :story_id,
20
- :time_in_minutes, :billable, :notes, :rate_in_cents,
21
- :currency, :currency_symbol, :currency_base_unit,
22
- :user_can_edit, :workspace_id, :user_id, :approved,
23
- :role_id, :external_reference, :location)
24
- end
25
-
26
- describe '.create_attributes' do
27
- let(:subject) { described_class.create_attributes }
28
-
29
- it 'includes expected attributes' do
30
- should match_array(%w(workspace_id date_performed time_in_minutes billable cost_rate_in_cents
31
- notes rate_in_cents story_id user_id external_reference location))
32
- end
33
- end
34
-
35
- describe '.update_attributes' do
36
- let(:subject) { described_class.update_attributes }
37
-
38
- it 'includes expected attributes' do
39
- should match_array(%w(date_performed time_in_minutes billable notes cost_rate_in_cents
40
- rate_in_cents story_id user_id external_reference))
41
- end
42
- end
43
- end
@@ -1,9 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Mavenlink::TimeOffEntry, stub_requests: true do
4
- it_should_behave_like "model", "time_off_entries"
5
-
6
- describe "association" do
7
- it { should respond_to :user }
8
- end
9
- end
@@ -1,138 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mavenlink::User, stub_requests: true do
4
- subject { described_class.send(:new) }
5
-
6
- let(:collection_name) { 'users' }
7
-
8
- let(:model) { described_class }
9
-
10
- let(:response) {
11
- {
12
- 'count' => 1,
13
- 'results' => [{'key' => collection_name, 'id' => '7'}],
14
- collection_name => {
15
- '7' => {'title' => 'My new record', 'id' => '7'}
16
- }
17
- }
18
- }
19
-
20
- before do
21
- stub_request :get, "/api/v1/#{collection_name}?only=7", response
22
- stub_request :get, "/api/v1/#{collection_name}?only=8", {'count' => 0, 'results' => []}
23
- stub_request :post, "/api/v1/#{collection_name}", response
24
- stub_request :delete, "/api/v1/#{collection_name}/4", {}
25
- end
26
-
27
- describe "associations" do
28
- it { should respond_to :external_references }
29
- end
30
-
31
- describe 'class methods' do
32
- subject { model }
33
- its(:collection_name) { should == collection_name }
34
-
35
- describe '.scoped' do
36
- subject { model.scoped }
37
-
38
- it { should be_a Mavenlink::Request }
39
- its(:collection_name) { should == collection_name }
40
- end
41
-
42
- describe '.find' do
43
- specify do
44
- expect(model.find(7)).to be_a model
45
- end
46
-
47
- specify do
48
- expect(model.find(7).id).to eq('7')
49
- end
50
-
51
- specify do
52
- expect(model.find(8)).to be_nil
53
- end
54
- end
55
-
56
- describe '.models' do
57
- specify do
58
- expect(model.models).to be_empty
59
- end
60
-
61
- specify do
62
- expect(Mavenlink::Model.models).to include({collection_name => model})
63
- end
64
- end
65
-
66
- describe '.specification' do
67
- specify do
68
- expect(model.specification).to be_a Hash
69
- end
70
-
71
- specify do
72
- expect(model.specification).not_to be_empty
73
- end
74
- end
75
-
76
- describe '.attributes' do
77
- specify do
78
- expect(model.attributes).to be_an Array
79
- end
80
-
81
- specify do
82
- expect(model.attributes).not_to be_empty
83
- end
84
- end
85
-
86
- describe '.available_attributes' do
87
- specify do
88
- expect(model.available_attributes).to be_an Array
89
- end
90
-
91
- specify do
92
- expect(model.available_attributes).not_to be_empty
93
- end
94
- end
95
-
96
- describe '.wrap' do
97
- context 'existing record' do
98
- let(:brainstem_record) do
99
- BrainstemAdaptor::Record.new(collection_name, '7', Mavenlink::Response.new(response))
100
- end
101
-
102
- specify do
103
- expect(model.wrap(brainstem_record)).not_to be_a_new_record
104
- end
105
-
106
- specify do
107
- expect(model.wrap(brainstem_record)).to be_a model
108
- end
109
- end
110
- end
111
- end
112
-
113
- describe '#initialize' do
114
- it 'accepts attributes' do
115
- expect(model.send(:new, any_custom_key: 'value set')).to include(any_custom_key: 'value set')
116
- end
117
- end
118
-
119
- describe '#persisted?' do
120
- specify do
121
- expect(model.send(:new)).not_to be_persisted
122
- end
123
-
124
- specify do
125
- expect(model.send(:new, id: 1)).to be_persisted
126
- end
127
- end
128
-
129
- describe '#new_record?' do
130
- specify do
131
- expect(model.send(:new)).to be_new_record
132
- end
133
-
134
- specify do
135
- expect(model.send(:new, id: 1)).not_to be_new_record
136
- end
137
- end
138
- end