iilyak opened a new pull request #2121: Add Mock library for testing
URL: https://github.com/apache/couchdb/pull/2121
 
 
   ## Overview
   
   Add mocking library to use from ExUnit based unit tests.
   
   ## Testing recommendations
   
   1. Create `src/couch/test/exunit/mocking_test.exs` file with the following 
content
     ```
     defmodule Couch.Test.Mocking do
       @moduledoc false
       use Couch.Test.ExUnit.Case
   
       alias Couch.Test.Setup
   
       import Mock
   
       def with_setup(context, setup) do
         setup =
           setup
           |> Setup.run()
   
         {context, setup}
       end
   
       describe "Testing mocking machinery" do
         @describetag setup: &__MODULE__.with_setup/2
         test "that we can mock CouchDB modules", _ctx do
           with_mock :fabric, all_dbs: fn -> :foo end do
             assert :fabric.all_dbs() == :foo, "Expected to get ':foo'"
           end
         end
       end
     end
     ```
   2. Run test suite `make exunit tests=src/couch/test/exunit/mocking_test.exs`
   
   ## Related Issues or Pull Requests
   
   N/A
   
   ## Checklist
   
   - [x] Code is written and works correctly
   - [ ] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [ ] A PR for documentation changes has been made in 
https://github.com/apache/couchdb-documentation
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to