Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

0.5.1 - [2021-04-12]

Fixed

0.5.0 - [2021-04-03]

Added

# target.yml
---
number: <%= object(be_positive) %>
RSpec.describe "something" do
    subject { { "number" => 42 } }
    
    # no explicit params is needed here
    let(:target) { load_fixture "target.yml" }
    
    it { is_expected.to match(target) }
end

0.4.1 - [2021-03-31]

Fixed

0.4.0 - [2020-03-15]

Added

---
- env: GOOGLE_CLOUD_KEY
  value: foo

- env: GOOGLE_CLOUD_PASSWORD
  value: bar

This would stub selected variables only, not touching the others

0.3.0 - [2020-03-08]

Added

---
- class: API
  chain: get_product
  arguments:
    - 1
  actions:
    - raise: API::NotFoundError
      arguments: # <--- that's that
        - "Cannot find a product by id: 1"

which would raise API::NotFoundError.new("Cannot find a product by id: 1")

0.2.0 - [2020-02-17]

Added

# ./changes.yml
---
- type: user
  params:
    id: 1

- const: DEFAULT_USER_ID
  value: 1

- url: https://example.com/users/default
  method: get
  responses:
    - body:
        id: 1
        name: Andrew
before { call_fixture "#{__dir__}/changes.yml" }

0.1.0 - [2020-02-09]

Added

yaml --- - url: example.com/foo method: get body: foobar query: foo: bar basic_auth: user: foo password: bar headers: Accept: utf-8 responses: - status: 200 body: foobar - status: 404

0.0.7 - [2019-07-01]

Added

yaml --- - object: Rails.application chain: - env actions: - return: production

Changed

yaml --- - class: Payment chain: - call arguments: - 1 - :overdraft: true actions: - return: 3

This works even though the key :notify was not defined by the stub:

ruby Payment.call 1, overdraft: true, notify: true

Notice, that these method works for key arguments only (symbolized hash as the last argument).

0.0.6 - [2019-06-09]

Added

The loader recognizes complex extensions like data.yml.erb or data.json.erb, as well as data.YAML in upper register.

You can send objects, that are stringified in a default Ruby way, into fixture loaders (seeds, stubs etc.) via ERB bindings. Those objects will be gracefully inserted into the resulting structure:

yaml --- :account: <%= user %>

“`ruby let(:user) { FactoryBot.create :user } subject { load_fixture “#{__dir__}/output.yml”, user: user }

# The user object has been bound via ERB it { is_expected.to eq account: user } “`

This feature can be used for adding RSpec matching arguments:

yaml --- :foo: <%= foo %> :bar: 3

ruby # Use the RSpecanyting` matcher subject { { foo: 4, bar: 3 } }

let(:template) { load_fixture “#{__dir__}/template.yml”, foo: anyting }

# The anyting has been bound via ERB to the template # Compare { foo: 4, bar: 3 } to the template { foo: anything, bar: 3 } it { is_expected.to include(template) } “`

Be careful though: the trick won't work with objects whose default method Object#to_s has been overloaded.

0.0.5 - [2018-06-04]

Added

yaml # Stub constant TIMEOUT_SEC to 10 --- - const: TIMEOUT_SEC value: 10

0.0.4 - [2018-05-22]

Added

yaml # Seed 3 customers --- - type: user count: 3 traits: - customer

0.0.3 - [2018-05-04]

Added

ruby RSpec.configure do |c| c.before(:suite) { Fixturama.start_ids_from(1_000_000_000) } end

0.0.2 - [2018-04-27]

Added

“`yaml — - class: Balance chain: debet arguments: 0 actions: - return: 1

0.0.1 - [2018-03-01]

This is a first public release with features extracted from production app.