GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jsl/shamrock: Set up stub services in your application

BranchesTags
Open more actions menu

Latest commit

 

History

25 Commits
25 Commits

Folders and files

NameName
Last commit message
Last commit date
integration_spec
integration_spec
 
 
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
.travis.yml
.travis.yml
 
 
Gemfile
Gemfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
shamrock.gemspec
shamrock.gemspec
 
 

Repository files navigation

Build Status

Shamrock

Makes setting up stub services easy.

Installation

Add this line to your application's Gemfile:

gem 'shamrock'

And then execute:

$ bundle

Or install it yourself as:

$ gem install shamrock

Usage

You can then easily start the stub service either for the spec examples that need it, or globally in your spec_helper file. You can replace the Proc below with any Rack application. In some cases, we use Sinatra for stub services.

my_rack_app = proc {|env| [200, {"Content-Type" => "text/html"}, ["Hello Rack!"]]}
@service = Shamrock::Service.new(my_rack_app)
@service.start
@service.uri    # => #<URI::HTTP http://localhost:54321>

After you are done with the service:

@service.stop

Credits

Thanks to Wojciech Mach (http://github.com/wojtekmach) who helped to implement something like this for a stub service on a project for Stack Builders.

Thanks to Mike Barinek for writing up an example of this code that used Threads for starting the rack application - this gem draws from code in his blog post at http://pivotallabs.com/users/mbarinek/blog/articles/2043-testing-ruby-services-without-mocks

Thanks to Kurt Eldridge (http://github.com/truk) for pair programming on a test problem with Threads.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Set up stub services in your application

Resources

Readme
MIT license
Activity

Stars

32 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.