Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meck:received/3 API for easier history checking #23

Merged
merged 3 commits into from
Mar 30, 2011

Commits on Mar 24, 2011

  1. Add meck:received/3 helper to wrap meck:history/1

    The purpose of meck:receive/3 is to provide those writing tests to write
    cleaner unit test code such that they can easily declare what calls should
    have been received on a module with arguments like so:
      mymod_test_test() ->
        ok = meck:new(mymod),
        ok = meck:expect(mymod, test, 0, ok),
        %% call some public API
        ?assertEquals(true, meck:received(mymod, test, [])),
        ?assert(meck:validate(mymod)).
    
    This way the unit tester does not need to know the format of history/1 entries.
    
    This is similar to basic mock received expectations seen in Ruby libraries
    like RSpec mocks/stubs, e.g.:
      myclass.should_receive(:method1).with(Arg1, Arg2)
    
    This is only the tip of the iceberg as to what writing cleaner received
    expectations for unit testing code, especially when compared to RSpec's API.
    mbbx6spp committed Mar 24, 2011
    Configuration menu
    Copy the full SHA
    f1e0022 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2011

  1. Modified received/3 feature with changes suggested

    Changes suggested by eproxus on GitHub for merging into canonical meck
    repository that are made in this commit are:
    * Fix EDoc spec typo: s/Arity::int()/Args::list(term())/
    * Repalce use of deprecated bool() to boolean() in EDoc spec
    * Replace use of deprecated bool() to boolean() in spec annotation
    * Update @doc summary text to eproxus' suggestion for clarity
    * Rename received function name to called
    * Rename has_call_info function name to has_been_called
    * Placed meck:history(Mod) call inline of has_been_called call
    mbbx6spp committed Mar 25, 2011
    Configuration menu
    Copy the full SHA
    27accbf View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2011

  1. Rename private function as per @eproxus suggestion

    This commit includes:
     * Renaming of private function name from has_been_called to has_call
    with same arguments. This is in reference to the GitHub pull request
    (eproxus#23) commit comment by @eproxus.
    mbbx6spp committed Mar 29, 2011
    Configuration menu
    Copy the full SHA
    735856b View commit details
    Browse the repository at this point in the history