Skip to content

Support PORO object <de>serialization

Compare
Choose a tag to compare
@nepalez nepalez released this 03 Apr 18:44
· 2 commits to master since this release

Use object() method to serialize/deserialize PORO objects in a fixture:

# target.yml
---
number: <%= object(be_positive) %>
RSpec.describe "example" do
  subject { { number: 42 } }

  # no explicit parameters are needed to send `be_positive`
  let(:target) { load_fixture "target.yml" }

  it { is_expected.to match(target) }
end

In versions v0.4.1 and below, the same feature required sending data explicitly:

---
number: <%= positive %>
RSpec.describe "example" do
  # ...
  let(:target) { load_fixture "target.yml", positive: be_positive }
  # ...
end