The project is in a healthy, maintained state
Rails Response Dumper is a library and command line tool to dump HTTP responses from a Rails application to the file system. These responses can then be consumed by other tools for testing and verification purposes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Runtime

~> 6.1
 Project Readme

Rails Response Dumper

Rails Response Dumper is a library and command line tool to dump HTTP responses from a Rails application to the file system. These responses can then be consumed by other tools for testing and verification purposes.

Installation

$ bundle add rails-response-dumper --group=development,test

Usage

Add the dumpers directory to the root of your Rails application. In this directory, define classes that extend ResponseDumper. Each method that starts with dump_ will generate a dump file in the dumps directory. Rails path methods are available.

# dumpers/users_response_dumper.rb

class UsersResponseDumper < ResponseDumper
  def dump_index
    get users_index_path
  end
end

Running the command rails-response-dumper will create the directory dumps and fill it with dump files.

$ rails-response-dumper
$ tree dumps
dumps
└── users_response_dumper
    └── dump_index.html

Just like tests, the dump methods can include setup code to add records to the database or include other side effects to build a more interesting dump. Dumps run in a transaction that always rollsback at the end.

ResponseDumper::reset_models

NOTE: This feature is only supported on PostgreSQL.

The class method ResponseDumper::reset_models can be used to reset database sequences between runs. If a model ID value is included in the dump and it is important that this value is reproducible on each run, use this method.

# dumpers/users_response_dumper.rb

class UsersResponseDumper < ResponseDumper
  reset_models User

  def dump_index
    User.create!(name: 'Alice')
    get users_index_path
  end
end