Skip to content

Latest commit

 

History

History
308 lines (224 loc) · 6.24 KB

CHANGELOG.md

File metadata and controls

308 lines (224 loc) · 6.24 KB

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

  • Marshalling of short strings (nepalez)

0.5.0 - [2021-04-03]

Added

  • Support for serialization PORO objects (nepalez)
# 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

  • Dependency from hashie updated to allow v4+ (nepalez)

0.4.0 - [2020-03-15]

Added

  • Support for stubbing ENV variables (nepalez)
---
- 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

  • Support for exception arguments (nepalez)
---
- 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

  • Stubbing and seeding from the same source file via the call_fixture method (nepalez)
# ./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

  • Stubbing of the HTTP requests using webmock (nepalez)

    ---
    - 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

  • Stubbing of an arbitrary option (nepalez)

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

Changed

  • Partially defined options will satisfy an expectation (nepalez)

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

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

    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

  • Better matching of YAML/JSON files (nepalez)

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

  • Support for Ruby objects (including Activerecord models) serialization in the parameters of fixtures (nepalez)

    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:

    ---
    :account: <%= user %>
    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:

    ---
    :foo: <%= foo %>
    :bar: 3
    # Use the RSpec `anyting` 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

  • Support for stubbing constants (nepalez)

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

0.0.4 - [2018-05-22]

Added

  • The :count option for a number of objects to seed at once (nepalez)

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

0.0.3 - [2018-05-04]

Added

  • Helper method to configuge start ids (sclinede, nepalez)

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

0.0.2 - [2018-04-27]

Added

  • Restriction of stub by arguments (nepalez)

    ---
    - class: Balance
      chain: debet
      arguments: 0
      actions:
        - return: 1
    
    - class: Balance
      chain: debet
      arguments: 1
      actions:
        - return: 0
        - raise: UnsifficientFunds
    
    - class: Balance
      chain: debet
      arguments: 2
      actions:
        - raise: UnsifficientFunds

0.0.1 - [2018-03-01]

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