Skip to content

Commit

Permalink
Merge 3cbbb7c into 876e636
Browse files Browse the repository at this point in the history
  • Loading branch information
zokioki committed Sep 17, 2019
2 parents 876e636 + 3cbbb7c commit f8e34b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## master

## 0.5.4 (2019-09-17)

- [PR #38](https://github.com/DmitryTsepelev/store_model/pull/38) Fix inspect output for false values ([@zokioki][])

## 0.5.3 (2019-09-05)

- [PR #34](https://github.com/DmitryTsepelev/store_model/pull/34) Fix `#unknown_attributes` assignment for `ArrayType` ([@iarie][])
Expand Down Expand Up @@ -57,5 +61,5 @@

- Initial version ([@DmitryTsepelev][])

[@DmitryTsepelev]: https://github.com/DmitryTsepelev
[@dmitrytsepelev]: https://github.com/DmitryTsepelev
[@iarie]: https://github.com/iarie
3 changes: 2 additions & 1 deletion lib/store_model/model.rb
Expand Up @@ -49,7 +49,8 @@ def blank?
#
# @return [String]
def inspect
attribute_string = attributes.map { |name, value| "#{name}: #{value || 'nil'}" }.join(", ")
attribute_string = attributes.map { |name, value| "#{name}: #{value.nil? ? 'nil' : value}" }
.join(", ")
"#<#{self.class.name} #{attribute_string}>"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/store_model/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module StoreModel # :nodoc:
VERSION = "0.5.3"
VERSION = "0.5.4"
end
2 changes: 2 additions & 0 deletions spec/dummy/app/models/configuration.rb
Expand Up @@ -4,6 +4,8 @@ class Configuration
include StoreModel::Model

attribute :color, :string
attribute :model, :string
attribute :active, :boolean
attribute :disabled_at, :datetime

validates :color, presence: true
Expand Down
10 changes: 8 additions & 2 deletions spec/store_model/model_spec.rb
Expand Up @@ -4,7 +4,12 @@

RSpec.describe StoreModel::Model do
let(:attributes) do
{ color: "red", disabled_at: Time.new(2019, 2, 10, 12) }
{
color: "red",
model: nil,
active: false,
disabled_at: Time.new(2019, 2, 10, 12)
}
end

describe "#initialize" do
Expand Down Expand Up @@ -46,7 +51,8 @@

it "prints description" do
expect(subject).to eq(
"#<Configuration color: red, disabled_at: #{attributes[:disabled_at]}>"
"#<Configuration color: red, model: nil, active: false, " \
"disabled_at: #{attributes[:disabled_at]}>"
)
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/store_model/types/json_type_spec.rb
Expand Up @@ -8,6 +8,8 @@
let(:attributes) do
{
color: "red",
model: nil,
active: false,
disabled_at: Time.new(2019, 2, 22, 12, 30)
}
end
Expand Down

0 comments on commit f8e34b8

Please sign in to comment.