daisybill_api 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -6
- data/lib/daisybill_api.rb +5 -5
- data/lib/daisybill_api/configuration.rb +3 -3
- data/lib/daisybill_api/data.rb +2 -2
- data/lib/daisybill_api/data/client.rb +18 -12
- data/lib/daisybill_api/data/url.rb +2 -2
- data/lib/daisybill_api/ext.rb +5 -5
- data/lib/daisybill_api/ext/associations.rb +1 -0
- data/lib/daisybill_api/ext/attributes.rb +2 -2
- data/lib/daisybill_api/ext/attributes/type_castings.rb +10 -4
- data/lib/daisybill_api/ext/crud.rb +12 -11
- data/lib/daisybill_api/ext/crud/create.rb +2 -2
- data/lib/daisybill_api/ext/crud/update.rb +1 -1
- data/lib/daisybill_api/ext/crud/write_off.rb +11 -0
- data/lib/daisybill_api/ext/links.rb +3 -3
- data/lib/daisybill_api/ext/links/link.rb +2 -2
- data/lib/daisybill_api/models.rb +31 -26
- data/lib/daisybill_api/models/attachment.rb +3 -2
- data/lib/daisybill_api/models/base.rb +1 -1
- data/lib/daisybill_api/models/bill.rb +23 -10
- data/lib/daisybill_api/models/bill_mailing_address.rb +16 -0
- data/lib/daisybill_api/models/bill_payment.rb +6 -5
- data/lib/daisybill_api/models/bill_submission.rb +2 -2
- data/lib/daisybill_api/models/billing_provider.rb +10 -10
- data/lib/daisybill_api/models/claim_adjustment_reason.rb +11 -0
- data/lib/daisybill_api/models/claims_administrator.rb +2 -1
- data/lib/daisybill_api/models/contact.rb +19 -11
- data/lib/daisybill_api/models/error_report.rb +30 -0
- data/lib/daisybill_api/models/injury.rb +1 -0
- data/lib/daisybill_api/models/paper_eor.rb +6 -3
- data/lib/daisybill_api/models/patient.rb +4 -3
- data/lib/daisybill_api/models/payer.rb +3 -1
- data/lib/daisybill_api/models/pharmacy_bill.rb +20 -8
- data/lib/daisybill_api/models/place_of_service.rb +4 -3
- data/lib/daisybill_api/models/prescribing_provider.rb +2 -2
- data/lib/daisybill_api/models/referring_provider.rb +2 -2
- data/lib/daisybill_api/models/remittance.rb +3 -3
- data/lib/daisybill_api/models/rendering_provider.rb +2 -2
- data/lib/daisybill_api/models/request_for_second_review.rb +3 -3
- data/lib/daisybill_api/models/service_line_item_payment.rb +14 -0
- data/lib/daisybill_api/models/task.rb +26 -0
- data/lib/daisybill_api/models/user.rb +16 -0
- data/lib/daisybill_api/version.rb +1 -1
- data/spec/daisybill_api/configuration_spec.rb +3 -3
- data/spec/daisybill_api/data/client_spec.rb +44 -38
- data/spec/daisybill_api/data/rest_client/payload_spec.rb +6 -6
- data/spec/daisybill_api/data/url_spec.rb +6 -6
- data/spec/daisybill_api/ext/attributes/attribute_spec.rb +32 -32
- data/spec/daisybill_api/ext/attributes/type_castings_spec.rb +22 -18
- data/spec/daisybill_api/ext/links/link_spec.rb +15 -15
- data/spec/daisybill_api/ext/pageable_collection_spec.rb +1 -1
- data/spec/daisybill_api/models/address_spec.rb +1 -1
- data/spec/daisybill_api/models/attachment_spec.rb +3 -3
- data/spec/daisybill_api/models/bill_mailing_address_spec.rb +6 -0
- data/spec/daisybill_api/models/bill_payment_spec.rb +5 -3
- data/spec/daisybill_api/models/bill_spec.rb +6 -4
- data/spec/daisybill_api/models/bill_submission_spec.rb +2 -2
- data/spec/daisybill_api/models/billing_provider_spec.rb +2 -2
- data/spec/daisybill_api/models/claim_number_verification_spec.rb +1 -1
- data/spec/daisybill_api/models/claims_administrator_spec.rb +3 -2
- data/spec/daisybill_api/models/contact_spec.rb +29 -3
- data/spec/daisybill_api/models/disputed_service_spec.rb +1 -1
- data/spec/daisybill_api/models/employer_spec.rb +1 -1
- data/spec/daisybill_api/models/error_report_spec.rb +10 -0
- data/spec/daisybill_api/models/injury_spec.rb +2 -1
- data/spec/daisybill_api/models/paper_eor_spec.rb +4 -3
- data/spec/daisybill_api/models/patient_spec.rb +4 -4
- data/spec/daisybill_api/models/payer_spec.rb +3 -2
- data/spec/daisybill_api/models/{pharamcy_bill_spec.rb → pharmacy_bill_spec.rb} +7 -6
- data/spec/daisybill_api/models/place_of_service_spec.rb +5 -5
- data/spec/daisybill_api/models/prescribing_provider_spec.rb +2 -2
- data/spec/daisybill_api/models/referring_provider_spec.rb +2 -2
- data/spec/daisybill_api/models/remittance_spec.rb +2 -2
- data/spec/daisybill_api/models/rendering_provider_spec.rb +2 -2
- data/spec/daisybill_api/models/request_for_second_review_spec.rb +2 -2
- data/spec/daisybill_api/models/service_line_item_payment_spec.rb +6 -0
- data/spec/daisybill_api/models/service_line_item_spec.rb +1 -1
- data/spec/daisybill_api/models/task_spec.rb +19 -0
- data/spec/daisybill_api/models/user_spec.rb +14 -0
- data/spec/daisybill_api_spec.rb +10 -10
- metadata +21 -4
@@ -1,7 +1,7 @@
|
|
1
1
|
module DaisybillApi
|
2
2
|
module Models
|
3
3
|
class ReferringProvider < DaisybillApi::Models::Base
|
4
|
-
path_prefix
|
4
|
+
path_prefix "/billing_providers", :billing_provider_id
|
5
5
|
rest_actions :index, :show, :create, :update
|
6
6
|
|
7
7
|
attribute :id, :integer, readonly: true
|
@@ -15,7 +15,7 @@ module DaisybillApi
|
|
15
15
|
active: :boolean
|
16
16
|
)
|
17
17
|
|
18
|
-
link :billing_provider, class:
|
18
|
+
link :billing_provider, class: "BillingProvider"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DaisybillApi
|
2
2
|
module Models
|
3
3
|
class Remittance < DaisybillApi::Models::Base
|
4
|
-
path_prefix
|
4
|
+
path_prefix "/billing_providers", :billing_provider_id
|
5
5
|
rest_actions :index, :show, :create
|
6
6
|
attributes id: :integer, readonly: true
|
7
7
|
attributes(
|
@@ -12,9 +12,9 @@ module DaisybillApi
|
|
12
12
|
bill_payments: [DaisybillApi::Models::BillPayment]
|
13
13
|
)
|
14
14
|
|
15
|
-
has_many :paper_eors, class:
|
15
|
+
has_many :paper_eors, class: "PaperEor"
|
16
16
|
|
17
|
-
link :billing_provider, class:
|
17
|
+
link :billing_provider, class: "BillingProvider"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DaisybillApi
|
2
2
|
module Models
|
3
3
|
class RenderingProvider < DaisybillApi::Models::Base
|
4
|
-
path_prefix
|
4
|
+
path_prefix "/billing_providers", :billing_provider_id
|
5
5
|
rest_actions :index, :show, :create, :update
|
6
6
|
|
7
7
|
attribute :id, :integer, readonly: true
|
@@ -17,7 +17,7 @@ module DaisybillApi
|
|
17
17
|
active: :boolean
|
18
18
|
)
|
19
19
|
|
20
|
-
link :billing_provider, class:
|
20
|
+
link :billing_provider, class: "BillingProvider"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -2,8 +2,8 @@ module DaisybillApi
|
|
2
2
|
module Models
|
3
3
|
class RequestForSecondReview < DaisybillApi::Models::Base
|
4
4
|
rest_actions :create
|
5
|
-
self.path =
|
6
|
-
path_prefix
|
5
|
+
self.path = "/requests_for_second_review"
|
6
|
+
path_prefix "/bills", :bill_id
|
7
7
|
|
8
8
|
attributes(
|
9
9
|
id: :integer,
|
@@ -15,7 +15,7 @@ module DaisybillApi
|
|
15
15
|
disputed_services: [DaisybillApi::Models::DisputedService]
|
16
16
|
)
|
17
17
|
|
18
|
-
link :bill, class:
|
18
|
+
link :bill, class: "Bill"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module DaisybillApi
|
2
|
+
module Models
|
3
|
+
class ServiceLineItemPayment < DaisybillApi::Models::Base
|
4
|
+
attributes(
|
5
|
+
service_line_item_id: :integer,
|
6
|
+
procedure_code: :string,
|
7
|
+
units: :float,
|
8
|
+
payment_amount_cents: :integer,
|
9
|
+
claim_adjustment_reasons: [DaisybillApi::Models::ClaimAdjustmentReason],
|
10
|
+
readonly: true
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module DaisybillApi
|
2
|
+
module Models
|
3
|
+
class Task < DaisybillApi::Models::Base
|
4
|
+
path_prefix "/bills", :bill_id
|
5
|
+
rest_actions :index, :show, :create, :update
|
6
|
+
|
7
|
+
attributes(
|
8
|
+
id: :integer,
|
9
|
+
readonly: true
|
10
|
+
)
|
11
|
+
|
12
|
+
attributes(
|
13
|
+
assigned_user_id: :integer,
|
14
|
+
bill_id: :integer,
|
15
|
+
completed_by_id: :integer,
|
16
|
+
completed_on: :date,
|
17
|
+
due_date: :date,
|
18
|
+
message: :string
|
19
|
+
)
|
20
|
+
|
21
|
+
link :assigned_user, class: "User"
|
22
|
+
link :bill, class: "Bill"
|
23
|
+
link :completed_by, class: "User"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DaisybillApi
|
2
|
+
module Models
|
3
|
+
class User < DaisybillApi::Models::Base
|
4
|
+
rest_actions :show, :index
|
5
|
+
|
6
|
+
attributes(
|
7
|
+
id: :integer,
|
8
|
+
first_name: :string,
|
9
|
+
last_name: :string,
|
10
|
+
email: :string,
|
11
|
+
active: :boolean,
|
12
|
+
readonly: true
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe DaisybillApi::Configuration do
|
4
4
|
let(:config) { DaisybillApi::Configuration.new }
|
5
5
|
|
6
|
-
context
|
6
|
+
context "default values" do
|
7
7
|
it { expect(config.api_token).to be_nil }
|
8
8
|
it { expect(config.port).to eq 443 }
|
9
|
-
it { expect(config.host).to eq
|
9
|
+
it { expect(config.host).to eq "go.daisybill.com" }
|
10
10
|
it { expect(config.logger).to be_a Logger }
|
11
11
|
end
|
12
12
|
it "when logger was set to nil" do
|
@@ -1,100 +1,106 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
shared_examples_for
|
3
|
+
shared_examples_for "returned error with status" do |status|
|
4
4
|
its(:status) { is_expected.to eq status }
|
5
5
|
its(:response) { is_expected.to be_a Hash }
|
6
|
-
its(:response) { is_expected.to have_key(
|
6
|
+
its(:response) { is_expected.to have_key("error") }
|
7
7
|
end
|
8
8
|
|
9
9
|
describe DaisybillApi::Data::Client, :vcr do
|
10
10
|
let(:method) { :get }
|
11
11
|
let(:params) { {} }
|
12
|
-
let(:path) {
|
12
|
+
let(:path) { "/billing_providers/25" }
|
13
13
|
|
14
14
|
subject { DaisybillApi::Data::Client.new(method, path, params) }
|
15
15
|
|
16
|
-
context
|
16
|
+
context "when everything fine" do
|
17
17
|
it { is_expected.to be_success }
|
18
18
|
its(:response) { is_expected.to be_a Hash }
|
19
|
-
its(:response) { is_expected.to have_key(
|
20
|
-
its(:response) { is_expected.to have_key(
|
21
|
-
its(:response) { is_expected.to have_key(
|
19
|
+
its(:response) { is_expected.to have_key("id") }
|
20
|
+
its(:response) { is_expected.to have_key("name") }
|
21
|
+
its(:response) { is_expected.to have_key("fein") }
|
22
22
|
end
|
23
23
|
|
24
|
-
context
|
25
|
-
before { DaisybillApi.configuration.api_token =
|
24
|
+
context "when incorrect API token" do
|
25
|
+
before { DaisybillApi.configuration.api_token = "incorrect token" }
|
26
26
|
|
27
|
-
it_behaves_like
|
27
|
+
it_behaves_like "returned error with status", "401"
|
28
28
|
end
|
29
29
|
|
30
|
-
context
|
31
|
-
let(:path) {
|
30
|
+
context "when incorrect url" do
|
31
|
+
let(:path) { "/incorrect/url" }
|
32
32
|
|
33
|
-
it_behaves_like
|
33
|
+
it_behaves_like "returned error with status", "401"
|
34
34
|
end
|
35
35
|
|
36
|
-
context
|
37
|
-
let(:params) { { created_on:
|
38
|
-
let(:path) {
|
36
|
+
context "when invalid params" do
|
37
|
+
let(:params) { { created_on: "invalid" } }
|
38
|
+
let(:path) { "/invalid/params" }
|
39
39
|
|
40
|
-
it_behaves_like
|
40
|
+
it_behaves_like "returned error with status", "403"
|
41
41
|
end
|
42
42
|
|
43
|
-
context
|
44
|
-
let(:path) {
|
43
|
+
context "when record was not found" do
|
44
|
+
let(:path) { "/billing_providers/unknown-id" }
|
45
45
|
|
46
|
-
it_behaves_like
|
46
|
+
it_behaves_like "returned error with status", "404"
|
47
47
|
end
|
48
48
|
|
49
|
-
context
|
50
|
-
let(:
|
49
|
+
context "when method is not allowed" do
|
50
|
+
let(:method) { :post }
|
51
51
|
|
52
|
-
it_behaves_like
|
52
|
+
it_behaves_like "returned error with status", "405"
|
53
53
|
end
|
54
54
|
|
55
|
-
context
|
56
|
-
|
55
|
+
context "when server raised error" do
|
56
|
+
let(:path) { "/raised/error" }
|
57
|
+
|
58
|
+
it_behaves_like "returned error with status", "500"
|
59
|
+
end
|
60
|
+
|
61
|
+
context ".build" do
|
62
|
+
subject { -> { described_class.build :method, "/path" } }
|
57
63
|
let(:status) { 200 }
|
58
|
-
let(:message) {
|
64
|
+
let(:message) { "" }
|
59
65
|
|
60
66
|
before do
|
61
|
-
client = doubled_client(status, {
|
67
|
+
client = doubled_client(status, { "error" => message })
|
62
68
|
allow(DaisybillApi::Data::Client).to receive(:new).and_return(client)
|
63
69
|
end
|
64
70
|
|
65
71
|
it { is_expected.not_to raise_error }
|
66
72
|
|
67
|
-
context
|
73
|
+
context "when bad request" do
|
68
74
|
let(:status) { 400 }
|
69
|
-
let(:message) {
|
75
|
+
let(:message) { "invalid record" }
|
70
76
|
|
71
77
|
it { is_expected.not_to raise_error }
|
72
78
|
end
|
73
79
|
|
74
|
-
context
|
80
|
+
context "when unauthorized" do
|
75
81
|
let(:status) { 401 }
|
76
|
-
let(:message) {
|
82
|
+
let(:message) { "invalid or missed api token" }
|
77
83
|
|
78
84
|
it { is_expected.to raise_error(DaisybillApi::Data::Client::UnauthorizedError).with_message(message) }
|
79
85
|
end
|
80
86
|
|
81
|
-
context
|
87
|
+
context "when forbidden" do
|
82
88
|
let(:status) { 403 }
|
83
|
-
let(:message) {
|
89
|
+
let(:message) { "invalid params or incorrect url endpoint" }
|
84
90
|
|
85
91
|
it { is_expected.to raise_error(DaisybillApi::Data::Client::InvalidParams).with_message(message) }
|
86
92
|
end
|
87
93
|
|
88
|
-
context
|
94
|
+
context "when page not found" do
|
89
95
|
let(:status) { 404 }
|
90
|
-
let(:response) { { error:
|
96
|
+
let(:response) { { error: "Record Not Found" } }
|
91
97
|
|
92
98
|
it { is_expected.to_not raise_error }
|
93
99
|
end
|
94
100
|
|
95
|
-
context
|
101
|
+
context "when internal server error" do
|
96
102
|
let(:status) { 500 }
|
97
|
-
let(:message) {
|
103
|
+
let(:message) { "Internal Server Error" }
|
98
104
|
|
99
105
|
it { is_expected.to raise_error(DaisybillApi::Data::Client::InternalServerError).with_message(message) }
|
100
106
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe RestClient::Payload do
|
4
4
|
subject { RestClient::Payload.generate(params).to_s }
|
5
5
|
|
6
|
-
context
|
6
|
+
context "when collection of hashes" do
|
7
7
|
let(:params) { { collection: [{ a: 1, b: 2 }, { a: 3, b: 4 }] } }
|
8
8
|
|
9
|
-
it { is_expected.to eq
|
9
|
+
it { is_expected.to eq "collection[][a]=1&collection[][b]=2&collection[][a]=3&collection[][b]=4" }
|
10
10
|
end
|
11
11
|
|
12
|
-
context
|
13
|
-
let(:params) { { empty:
|
12
|
+
context "when value is nil" do
|
13
|
+
let(:params) { { empty: "", nil: nil, zero: 0 } }
|
14
14
|
|
15
|
-
it { is_expected.to eq
|
15
|
+
it { is_expected.to eq "empty=&nil&zero=0" }
|
16
16
|
end
|
17
17
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe DaisybillApi::Data::Url do
|
4
|
-
before { DaisybillApi.configure { |c| c.api_token =
|
5
|
-
let(:path) {
|
4
|
+
before { DaisybillApi.configure { |c| c.api_token = "token" } }
|
5
|
+
let(:path) { "billing_providers" }
|
6
6
|
let(:params) { { page: 1, per_page: 20 } }
|
7
7
|
|
8
8
|
subject { DaisybillApi::Data::Url.build(path, params).to_s }
|
9
9
|
|
10
|
-
it { is_expected.to include
|
11
|
-
it { is_expected.to include
|
12
|
-
it { is_expected.to include
|
10
|
+
it { is_expected.to include "page=1" }
|
11
|
+
it { is_expected.to include "per_page=20" }
|
12
|
+
it { is_expected.to include "api_token=token" }
|
13
13
|
end
|
@@ -1,71 +1,71 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe DaisybillApi::Ext::Attributes::Attribute do
|
4
|
-
let(:name) {
|
4
|
+
let(:name) { "description" }
|
5
5
|
let(:type) { :string }
|
6
6
|
let(:options) { {} }
|
7
7
|
subject { described_class.new name, type, options }
|
8
8
|
|
9
|
-
it
|
10
|
-
expect(DaisybillApi::Ext::Attributes::TypeCastings).to receive(:convert_to).with(
|
11
|
-
subject.value =
|
9
|
+
it "#value=" do
|
10
|
+
expect(DaisybillApi::Ext::Attributes::TypeCastings).to receive(:convert_to).with("value", :string)
|
11
|
+
subject.value = "value"
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context "value" do
|
15
15
|
let(:type) { [:integer] }
|
16
16
|
|
17
17
|
its(:value) { is_expected.to eq [] }
|
18
18
|
end
|
19
19
|
|
20
|
-
context
|
20
|
+
context "#param_name" do
|
21
21
|
subject { super().param_name }
|
22
22
|
|
23
|
-
it { is_expected.to eq
|
23
|
+
it { is_expected.to eq "description" }
|
24
24
|
|
25
|
-
context
|
25
|
+
context "when type is model" do
|
26
26
|
let(:type) { DaisybillApi::Models::Address }
|
27
27
|
|
28
|
-
it { is_expected.to eq
|
28
|
+
it { is_expected.to eq "description_attributes" }
|
29
29
|
end
|
30
30
|
|
31
|
-
context
|
31
|
+
context "when type is a simple collection" do
|
32
32
|
let(:type) { [:integer] }
|
33
33
|
|
34
|
-
it { is_expected.to eq
|
34
|
+
it { is_expected.to eq "description" }
|
35
35
|
end
|
36
36
|
|
37
|
-
context
|
37
|
+
context "when type is a collection of models" do
|
38
38
|
let(:type) { [DaisybillApi::Models::Address] }
|
39
39
|
|
40
|
-
it { is_expected.to eq
|
40
|
+
it { is_expected.to eq "description_attributes" }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
context
|
45
|
-
let(:value) {
|
44
|
+
context "#param_value" do
|
45
|
+
let(:value) { "value" }
|
46
46
|
before { subject.value = value }
|
47
47
|
|
48
|
-
it { expect(subject.param_value).to eq
|
48
|
+
it { expect(subject.param_value).to eq "value" }
|
49
49
|
|
50
|
-
context
|
50
|
+
context "when type is model" do
|
51
51
|
let(:type) { DaisybillApi::Models::Address }
|
52
|
-
let(:attrs) { {
|
52
|
+
let(:attrs) { { "address_1" => "addr1", "address_2" => nil, "city" => "NY", "state" => "NY", "zip_code" => "123"} }
|
53
53
|
let(:value) { type.new attrs }
|
54
54
|
|
55
55
|
its(:param_value) { is_expected.to eq attrs }
|
56
56
|
end
|
57
57
|
|
58
|
-
context
|
58
|
+
context "when type is collection" do
|
59
59
|
let(:type) { [:integer] }
|
60
60
|
let(:value) { %w(13 666) }
|
61
61
|
|
62
62
|
its(:param_value) { is_expected.to eq [13, 666] }
|
63
63
|
end
|
64
64
|
|
65
|
-
context
|
65
|
+
context "when type is collection of models" do
|
66
66
|
let(:type) { [DaisybillApi::Models::Address] }
|
67
|
-
let(:attrs1) { {
|
68
|
-
let(:attrs2) { {
|
67
|
+
let(:attrs1) { { "address_1" => "addr1", "address_2" => "addr2", "city" => "City", "state" => "st", "zip_code" => "123" } }
|
68
|
+
let(:attrs2) { { "address_1" => "addr3", "address_2" => "addr4", "city" => "city", "state" => "St", "zip_code" => "456" } }
|
69
69
|
let(:value) do
|
70
70
|
[
|
71
71
|
DaisybillApi::Models::Address.new(attrs1),
|
@@ -77,41 +77,41 @@ describe DaisybillApi::Ext::Attributes::Attribute do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
context
|
81
|
-
context
|
80
|
+
context "#to_param" do
|
81
|
+
context "when not readonly" do
|
82
82
|
before { allow(subject).to receive(:readonly?).and_return(false) }
|
83
|
-
it
|
83
|
+
it "must call param_name method" do
|
84
84
|
expect(subject).to receive(:param_name)
|
85
85
|
subject.to_param
|
86
86
|
end
|
87
87
|
|
88
|
-
it
|
88
|
+
it "must call param_name method" do
|
89
89
|
expect(subject).to receive(:param_value)
|
90
90
|
subject.to_param
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
context
|
94
|
+
context "when readonly" do
|
95
95
|
before { allow(subject).to receive(:readonly?).and_return(true) }
|
96
96
|
|
97
|
-
it
|
97
|
+
it "must not call param_name method" do
|
98
98
|
expect(subject).to_not receive(:param_name)
|
99
99
|
subject.to_param
|
100
100
|
end
|
101
101
|
|
102
|
-
it
|
102
|
+
it "must not call param_name method" do
|
103
103
|
expect(subject).to_not receive(:param_value)
|
104
104
|
subject.to_param
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
context
|
109
|
+
context "#readonly?" do
|
110
110
|
subject { super().readonly? }
|
111
111
|
|
112
112
|
it { is_expected.to be_falsey }
|
113
113
|
|
114
|
-
context
|
114
|
+
context "when readonly passed" do
|
115
115
|
let(:options) { { readonly: true } }
|
116
116
|
|
117
117
|
it { is_expected.to be_truthy }
|