site_prism.vcr 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +33 -13
  4. data/Gemfile +9 -14
  5. data/README.md +14 -0
  6. data/TODO.md +10 -14
  7. data/lib/site_prism_vcr/applier.rb +11 -10
  8. data/lib/site_prism_vcr/dsl/adjuster.rb +28 -4
  9. data/lib/site_prism_vcr/dsl/initial_adjuster.rb +4 -1
  10. data/lib/site_prism_vcr/fixture.rb +19 -9
  11. data/lib/site_prism_vcr/fixtures/converter.rb +4 -4
  12. data/lib/site_prism_vcr/fixtures/handler.rb +7 -5
  13. data/lib/site_prism_vcr/fixtures/manager.rb +4 -4
  14. data/lib/site_prism_vcr/fixtures/modifiers/base.rb +11 -0
  15. data/lib/site_prism_vcr/fixtures/modifiers/home_path.rb +4 -6
  16. data/lib/site_prism_vcr/fixtures/modifiers/path.rb +5 -7
  17. data/lib/site_prism_vcr/fixtures/modifiers/relative_path.rb +21 -0
  18. data/lib/site_prism_vcr/fixtures.rb +2 -2
  19. data/lib/site_prism_vcr/options.rb +27 -2
  20. data/lib/site_prism_vcr/version.rb +1 -1
  21. data/lib/site_prism_vcr/waiter.rb +6 -0
  22. data/lib/site_prism_vcr.rb +1 -0
  23. data/site_prism.vcr.gemspec +3 -3
  24. data/spec/fixtures/arya_stark.yml +21 -27
  25. data/spec/fixtures/custom/blank.yml +21 -27
  26. data/spec/fixtures/custom/bran_stark.yml +21 -27
  27. data/spec/fixtures/custom/daenerys_targaryen.yml +21 -27
  28. data/spec/fixtures/jon_snow.yml +21 -27
  29. data/spec/fixtures/ned_stark.yml +21 -27
  30. data/spec/fixtures/robb_stark.yml +21 -27
  31. data/spec/spec_helper.rb +6 -0
  32. data/spec/spec_integration_helper.rb +16 -6
  33. data/spec/support/server.rb +8 -0
  34. data/spec/support/shared/integration/custom_fixtures.rb +5 -2
  35. data/spec/support/shared/integration/exchange.rb +11 -1
  36. data/spec/support/shared/integration/home_path.rb +14 -0
  37. data/spec/support/test_app/test_app.rb +30 -12
  38. data/spec/unit/applier_spec.rb +6 -13
  39. data/spec/unit/dsl/adjuster_spec.rb +78 -47
  40. data/spec/unit/dsl/initial_adjuster_spec.rb +14 -3
  41. data/spec/unit/fixture_spec.rb +43 -6
  42. data/spec/unit/fixtures/manager_spec.rb +31 -12
  43. data/spec/unit/fixtures/modifiers/path_spec.rb +2 -2
  44. data/spec/unit/fixtures/modifiers/relative_path_spec.rb +23 -0
  45. data/spec/unit/waiter_spec.rb +65 -31
  46. metadata +25 -19
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/max/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/max
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK'
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - '60'
27
- X-Ratelimit-Remaining:
28
- - '54'
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Arya Stark","cat_name":"Max"}'
42
36
  http_version:
43
- recorded_at: Thu, 23 May 2013 19:43:53 GMT
44
- recorded_with: VCR 2.5.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/max/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/max
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK '
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - "60"
27
- X-Ratelimit-Remaining:
28
- - "54"
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"<%= cat_owner %>","cat_name":"Max"}'
42
36
  http_version:
43
- recorded_at: Mon, 18 Mar 2013 21:29:05 GMT
44
- recorded_with: VCR 2.4.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/max/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/max
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK '
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - "60"
27
- X-Ratelimit-Remaining:
28
- - "54"
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Bran Stark","cat_name":"Max"}'
42
36
  http_version:
43
- recorded_at: Tue, 18 May 2013 23:31:55 GMT
44
- recorded_with: VCR 2.4.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/max/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/max
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK '
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - "60"
27
- X-Ratelimit-Remaining:
28
- - "54"
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Daenerys Targaryen","cat_name":"Max"}'
42
36
  http_version:
43
- recorded_at: Mon, 18 Mar 2013 21:29:05 GMT
44
- recorded_with: VCR 2.4.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/felix/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/felix
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK'
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - '60'
27
- X-Ratelimit-Remaining:
28
- - '54'
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Jon Snow","cat_name":"Felix"}'
42
36
  http_version:
43
- recorded_at: Mon, 18 Mar 2013 21:29:05 GMT
44
- recorded_with: VCR 2.5.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/max/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/max
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK'
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Mon, 18 Mar 2013 21:29:04 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - '60'
27
- X-Ratelimit-Remaining:
28
- - '54'
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Ned Stark","cat_name":"Max"}'
42
36
  http_version:
43
- recorded_at: Thu, 23 May 2013 19:43:53 GMT
44
- recorded_with: VCR 2.5.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
@@ -2,43 +2,37 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.github.com/users/felix/orgs
5
+ uri: http://127.0.0.1:<%= port %>/api/cat/felix
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
10
16
  response:
11
17
  status:
12
18
  code: 200
13
- message: OK
19
+ message: 'OK'
14
20
  headers:
15
- Server:
16
- - GitHub.com
17
- Date:
18
- - Sun, 12 May 2013 18:09:05 GMT
19
21
  Content-Type:
20
- - application/json; charset=utf-8
21
- Connection:
22
- - keep-alive
23
- Status:
24
- - 200 OK
25
- X-Ratelimit-Limit:
26
- - '60'
27
- X-Ratelimit-Remaining:
28
- - '54'
29
- X-Github-Media-Type:
30
- - github.beta
22
+ - application/json;charset=utf-8
23
+ Content-Length:
24
+ - '43'
31
25
  X-Content-Type-Options:
32
26
  - nosniff
33
- Content-Length:
34
- - '2'
35
- Etag:
36
- - '"d751713988987e9331980363e24189ce"'
37
- Cache-Control:
38
- - max-age=0, private, must-revalidate
27
+ Server:
28
+ - WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27)
29
+ Date:
30
+ - Mon, 13 Jan 2014 21:01:47 GMT
31
+ Connection:
32
+ - Keep-Alive
39
33
  body:
40
- encoding: ASCII-8BIT
34
+ encoding: UTF-8
41
35
  string: '{"cat_owner":"Robb Stark","cat_name":"Felix"}'
42
36
  http_version:
43
- recorded_at: Sun, 12 May 2013 18:09:05 GMT
44
- recorded_with: VCR 2.5.0
37
+ recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
38
+ recorded_with: VCR 2.8.0
data/spec/spec_helper.rb CHANGED
@@ -18,4 +18,10 @@ end
18
18
 
19
19
  VCR.configure do |c|
20
20
  c.cassette_library_dir = 'spec/fixtures'
21
+
22
+ c.default_cassette_options = {
23
+ erb: {
24
+ port: 111
25
+ }
26
+ }
21
27
  end
@@ -4,24 +4,34 @@ require 'capybara/rspec'
4
4
  require 'capybara/firebug'
5
5
 
6
6
  require 'support/test_app/test_app'
7
+ require 'support/server'
7
8
 
8
- Dir["./spec/support/shared/integration/**/*.rb"].sort.each {|f| require f }
9
- Dir["./spec/support/site_prism/pages/**/*.rb"].sort.each {|f| require f }
9
+ Dir['./spec/support/shared/integration/**/*.rb'].sort.each {|f| require f }
10
+ Dir['./spec/support/site_prism/pages/**/*.rb'].sort.each {|f| require f }
10
11
 
11
- Capybara.app = TestApp
12
+ Capybara.app = TestApp
12
13
  Capybara.default_driver = :selenium
13
- HTTPI.log = false
14
+ HTTPI.log = false
14
15
 
15
16
  Selenium::WebDriver::Firefox::Profile.firebug_version = '1.11.0'
16
17
 
18
+ Capybara.server_port = Server.find_available_port
19
+
17
20
  VCR.configure do |c|
18
21
  c.cassette_library_dir = 'spec/fixtures'
19
22
  c.hook_into :webmock
20
- c.ignore_localhost = true
23
+ c.ignore_localhost = false
21
24
  c.preserve_exact_body_bytes { false }
22
25
 
23
26
  c.default_cassette_options = {
24
27
  serialize_with: :psych,
25
- allow_playback_repeats: true
28
+ allow_playback_repeats: true,
29
+ erb: {
30
+ port: Capybara.server_port
31
+ }
26
32
  }
33
+
34
+ c.ignore_request do |req|
35
+ (req.uri =~ /api\/cat/).nil?
36
+ end
27
37
  end
@@ -0,0 +1,8 @@
1
+ module Server
2
+ def self.find_available_port
3
+ server = TCPServer.new('127.0.0.1', 0)
4
+ server.addr[1]
5
+ ensure
6
+ server.close if server
7
+ end
8
+ end
@@ -18,7 +18,10 @@ shared_examples 'when a custom fixture is applied' do
18
18
  {
19
19
  fixture: 'blank',
20
20
  options: {
21
- erb: {cat_owner: 'Robert Baratheon'}
21
+ erb: {
22
+ cat_owner: 'Robert Baratheon',
23
+ port: Capybara.server_port
24
+ }
22
25
  }
23
26
  }
24
27
  ]
@@ -42,7 +45,7 @@ shared_examples 'when a custom fixture is applied' do
42
45
  SPV::Helpers.eject_all_cassettes
43
46
  end
44
47
 
45
- it 'uses custom fixture anyway' do
48
+ it 'uses a custom fixture anyway' do
46
49
  expect(cat_owner).to have_content('Daenerys Targaryen')
47
50
  end
48
51
  end
@@ -30,7 +30,17 @@ shared_examples 'when a default fixture is exchanged' do
30
30
  context 'when fixtures are defined with Vcr options' do
31
31
  before do
32
32
  actor_with_home_path.public_send(action_method) do
33
- exchange '~/daenerys_targaryen', {fixture: '~/blank', options: {erb: {cat_owner: 'Robert Baratheon'} }}
33
+ exchange \
34
+ '~/daenerys_targaryen',
35
+ {
36
+ fixture: '~/blank',
37
+ options: {
38
+ erb: {
39
+ cat_owner: 'Robert Baratheon',
40
+ port: Capybara.server_port
41
+ }
42
+ }
43
+ }
34
44
  end
35
45
  end
36
46
 
@@ -46,4 +46,18 @@ shared_examples 'when a home path is define' do
46
46
 
47
47
  it_behaves_like 'expects the custom fixture on the page'
48
48
  end
49
+
50
+ context 'when a custom fixture which stored in the parent directory of the home path is applied' do
51
+ before do
52
+ actor_without_home_path.public_send(action_method) do
53
+ home_path 'custom'
54
+
55
+ fixtures ['~/../arya_stark']
56
+ end
57
+ end
58
+
59
+ it 'applies a stored fixture in the parent directory of the home path' do
60
+ expect(cat_owner).to have_content('Arya Stark')
61
+ end
62
+ end
49
63
  end
@@ -12,11 +12,27 @@ class TestApp < Sinatra::Base
12
12
  File.read("#{root}/public/test.js")
13
13
  end
14
14
 
15
+ get '/' do
16
+ erb :index, locals: {click_on: nil}
17
+ end
18
+
19
+ get '/immediate-http-interactions/one-request' do
20
+ erb :index, locals: {click_on: 'link_with_one_request'}
21
+ end
22
+
23
+ get '/immediate-http-interactions/two-requests' do
24
+ erb :index, locals: {click_on: 'link_with_2_requests'}
25
+ end
26
+
27
+ get '/immediate-http-interactions/home-path' do
28
+ erb :index, locals: {click_on: 'link_with_home_path'}
29
+ end
30
+
15
31
  get '/max.json' do
16
32
  content_type :json
17
33
 
18
34
  HTTPI.get(
19
- 'https://api.github.com/users/max/orgs'
35
+ "http://#{request.host}:#{request.port}/api/cat/max"
20
36
  ).body
21
37
  end
22
38
 
@@ -24,23 +40,25 @@ class TestApp < Sinatra::Base
24
40
  content_type :json
25
41
 
26
42
  HTTPI.get(
27
- 'https://api.github.com/users/felix/orgs'
43
+ "http://#{request.host}:#{request.port}/api/cat/felix"
28
44
  ).body
29
45
  end
30
46
 
31
- get '/' do
32
- erb :index, locals: {click_on: nil}
33
- end
47
+ get '/api/cat/max' do
48
+ content_type :json
34
49
 
35
- get '/immediate-http-interactions/one-request' do
36
- erb :index, locals: {click_on: 'link_with_one_request'}
50
+ {
51
+ cat_owner: 'Arya Stark',
52
+ cat_name: 'Max'
53
+ }.to_json
37
54
  end
38
55
 
39
- get '/immediate-http-interactions/two-requests' do
40
- erb :index, locals: {click_on: 'link_with_2_requests'}
41
- end
56
+ get '/api/cat/felix' do
57
+ content_type :json
42
58
 
43
- get '/immediate-http-interactions/home-path' do
44
- erb :index, locals: {click_on: 'link_with_home_path'}
59
+ {
60
+ cat_owner: 'Jon Snow',
61
+ cat_name: 'Felix'
62
+ }.to_json
45
63
  end
46
64
  end