Project

http_sim

0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
A set of utilities for creating simulators for your external HTTP integrations, great for acceptance tests and fallback services.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 3.0

Runtime

~> 0.13.7
~> 1.4.0
 Project Readme

http_sim - Easy HTTP Simulators

Build Status

Simulate your external HTTP integrations.

Contributions and issues very welcome.

Standalone usage

  1. Add gem 'http_sim' to your Gemfile

  2. bundle install

  3. Use this code somewhere:

    require 'http_sim'
    
    HttpSimulator.register_endpoint 'GET', '/hi', '{"some_json": true}'
    HttpSimulator.register_endpoint 'POST', '/bye', '<html><body>some html</body></html>'
    HttpSimulator.run!(port:6565)
  4. The endpoints GET /hi and POST /bye are now set up. Visit http://localhost:6565/ to see an index of running simulators and their helpers.

Test usage

  1. Add gem 'http_sim' to your Gemfile

  2. bundle install

  3. some_spec.rb:

    describe 'some spec' do
      before :each do
        HttpSimulator.reset_endpoints
        HttpSimulator.register_endpoint 'POST', '/some_simulated_endpoint', 'some_simulated_content'
        HttpSimulator.run_daemon!(port: 6565)
      end
    
      after :each do
        HttpSimulator.stop_daemon!
      end
    
      it 'does something that needs a simulator backing it' do
        # your test here
      end
    end

Contributing

  1. Fork it ( https://github.com/[my-github-username]/scaffold/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
    1. Please add a test
  4. Run tests with bundle install && rspec
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request