Skip to content

Commit

Permalink
start testing the sinatra app
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrias committed Oct 4, 2024
1 parent 1fa6da0 commit 3c0b981
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A service discovery mechanism for Factorial backend
Add the following lines in your Gemfile:

```ruby
gem 'resource_registry', github: 'factorialco/opening-resource-registry'
gem 'resource_registry', github: 'factorialco/resource-registry'
```

And run `bundle install`
Expand Down
3 changes: 2 additions & 1 deletion examples/sinatra-pet-shelter/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
source 'https://rubygems.org'

gem 'json'
gem 'resource_registry', github: 'factorialco/resource-registry'
gem 'sinatra'
gem 'sinatra-contrib'

group :development, :test do
gem 'pry'
gem 'rack-test'
gem 'rspec'
gem 'rspec-html-matchers'
end
19 changes: 19 additions & 0 deletions examples/sinatra-pet-shelter/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: https://github.com/factorialco/resource-registry.git
revision: 6bbde8294838cb9d29cf339021afd3ca8855d1d7
specs:
resource_registry (0.0.0)
sorbet-coerce (>= 0.2.6)
sorbet-runtime (= 0.5.11511)

GEM
remote: https://rubygems.org/
specs:
Expand All @@ -9,13 +17,16 @@ GEM
multi_json (1.15.0)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
polyfill (1.9.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.9)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -30,6 +41,7 @@ GEM
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby2_keywords (0.0.5)
safe_type (1.1.1)
sinatra (3.2.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
Expand All @@ -41,6 +53,11 @@ GEM
rack-protection (= 3.2.0)
sinatra (= 3.2.0)
tilt (~> 2.0)
sorbet-coerce (0.7.0)
polyfill (~> 1.8)
safe_type (~> 1.1, >= 1.1.1)
sorbet-runtime (>= 0.4.4704)
sorbet-runtime (0.5.11511)
tilt (2.4.0)

PLATFORMS
Expand All @@ -49,6 +66,8 @@ PLATFORMS
DEPENDENCIES
json
pry
rack-test
resource_registry!
rspec
sinatra
sinatra-contrib
Expand Down
11 changes: 11 additions & 0 deletions examples/sinatra-pet-shelter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Pet shelter example application

This is just an example API to show up how to use Resource Registry in a Ruby application.

## Start server

In order to start the server, run the following command:

```bash
ruby app.rb
```
File renamed without changes.
4 changes: 4 additions & 0 deletions examples/sinatra-pet-shelter/lib/repository.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class Repository
end
Empty file.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# frozen_string_literal: true

require 'spec_helper'
require_relative 'app'

describe App do
let(:app) { App.new }

context 'GET /' do
let(:response) { get '/members' }
let(:response) { get '/' }

it 'returns 200 OK' do
expect(response.status).to eq 200
Expand Down
11 changes: 11 additions & 0 deletions examples/sinatra-pet-shelter/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

ENV['APP_ENV'] = 'test'

require_relative '../lib/app'
require 'rspec'
require 'rack/test'

RSpec.configure do |_config|
include Rack::Test::Methods
end
7 changes: 0 additions & 7 deletions examples/sinatra-pet-shelter/spec_helper.rb

This file was deleted.

0 comments on commit 3c0b981

Please sign in to comment.