Skip to content

Commit e633be5

Browse files
authored
Merge pull request #120 from ryanhertz/MWEB-1217-defaultable-id
MWEB-1217: fixed symbol hash key bug in Defaultable
2 parents 28537aa + 01ac0ba commit e633be5

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v1.4.4
2+
- Fixed symbol hash key bug in Defaultable
3+
14
v1.4.3
25
- Change Finders and Defaultable to handle an api response of an empty array when finding a single resource.
36

Guardfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
guard :rspec, cmd: 'rspec' do
33
watch(%r{^spec/.+_spec\.rb$})
4-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
55
watch('spec/spec_helper.rb') { "spec" }
66
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.3
1+
1.4.4

lib/spark_api/models/defaultable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module ClassMethods
2121
def default(options = {})
2222
response = connection.get("/#{element_name}/default", options).first
2323
unless response.nil?
24-
response[:Id] = DEFAULT_ID if response[:Id].nil?
24+
response["Id"] = DEFAULT_ID if response["Id"].nil?
2525
new(response)
2626
end
2727
end

spec/unit/spark_api/models/defaultable_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TestClass < Base
1515
describe 'default' do
1616

1717
it 'returns an instance of the class' do
18-
allow(TestClass).to receive(:connection).and_return(double(get: [{Name: 'foo'}]))
18+
allow(TestClass).to receive(:connection).and_return(double(get: [{"Name" => 'foo'}]))
1919
expect(TestClass.default).to be_a TestClass
2020
end
2121

@@ -25,12 +25,12 @@ class TestClass < Base
2525
end
2626

2727
it "assigns the default id to the instance if it doesn't have an id" do
28-
allow(TestClass).to receive(:connection).and_return(double(get: [{Name: 'foo'}]))
28+
allow(TestClass).to receive(:connection).and_return(double(get: [{"Name" => 'foo'}]))
2929
expect(TestClass.default.Id).to eq TestClass::DEFAULT_ID
3030
end
3131

3232
it "doesn't override the id if one is present" do
33-
allow(TestClass).to receive(:connection).and_return(double(get: [{Id: '5', Name: 'foo'}]))
33+
allow(TestClass).to receive(:connection).and_return(double(get: [{"Id" => '5', "Name" => 'foo'}]))
3434
expect(TestClass.default.Id).to eq '5'
3535
end
3636

0 commit comments

Comments
 (0)