Skip to content

Commit 6e93000

Browse files
committed
Add a missing test case
1 parent 73576f5 commit 6e93000

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

spec/dynamoid/fields_spec.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,25 @@
7878
end
7979
end
8080

81-
context 'when specify key option and key_type' do
82-
it 'hash_key attribute is defined by key_type type' do
81+
context 'when :key and :key_type options specified' do
82+
it 'changes a hash key attribute declared type' do
8383
klass = new_class do
8484
table key: :hash_key, key_type: :integer
8585
end
8686

8787
expect(klass.attributes[:hash_key][:type]).to eq(:integer)
8888
end
89+
90+
it 'changes a hash key attribute actual type' do
91+
klass = new_class do
92+
table key: :hash_key, key_type: :integer
93+
field :name
94+
end
95+
96+
klass.create!(hash_key: 42, name: 'Alex')
97+
obj = klass.find(42)
98+
expect(obj.name).to eq 'Alex'
99+
end
89100
end
90101
end
91102

0 commit comments

Comments
 (0)