site_prism.vcr 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +33 -13
- data/Gemfile +9 -14
- data/README.md +14 -0
- data/TODO.md +10 -14
- data/lib/site_prism_vcr/applier.rb +11 -10
- data/lib/site_prism_vcr/dsl/adjuster.rb +28 -4
- data/lib/site_prism_vcr/dsl/initial_adjuster.rb +4 -1
- data/lib/site_prism_vcr/fixture.rb +19 -9
- data/lib/site_prism_vcr/fixtures/converter.rb +4 -4
- data/lib/site_prism_vcr/fixtures/handler.rb +7 -5
- data/lib/site_prism_vcr/fixtures/manager.rb +4 -4
- data/lib/site_prism_vcr/fixtures/modifiers/base.rb +11 -0
- data/lib/site_prism_vcr/fixtures/modifiers/home_path.rb +4 -6
- data/lib/site_prism_vcr/fixtures/modifiers/path.rb +5 -7
- data/lib/site_prism_vcr/fixtures/modifiers/relative_path.rb +21 -0
- data/lib/site_prism_vcr/fixtures.rb +2 -2
- data/lib/site_prism_vcr/options.rb +27 -2
- data/lib/site_prism_vcr/version.rb +1 -1
- data/lib/site_prism_vcr/waiter.rb +6 -0
- data/lib/site_prism_vcr.rb +1 -0
- data/site_prism.vcr.gemspec +3 -3
- data/spec/fixtures/arya_stark.yml +21 -27
- data/spec/fixtures/custom/blank.yml +21 -27
- data/spec/fixtures/custom/bran_stark.yml +21 -27
- data/spec/fixtures/custom/daenerys_targaryen.yml +21 -27
- data/spec/fixtures/jon_snow.yml +21 -27
- data/spec/fixtures/ned_stark.yml +21 -27
- data/spec/fixtures/robb_stark.yml +21 -27
- data/spec/spec_helper.rb +6 -0
- data/spec/spec_integration_helper.rb +16 -6
- data/spec/support/server.rb +8 -0
- data/spec/support/shared/integration/custom_fixtures.rb +5 -2
- data/spec/support/shared/integration/exchange.rb +11 -1
- data/spec/support/shared/integration/home_path.rb +14 -0
- data/spec/support/test_app/test_app.rb +30 -12
- data/spec/unit/applier_spec.rb +6 -13
- data/spec/unit/dsl/adjuster_spec.rb +78 -47
- data/spec/unit/dsl/initial_adjuster_spec.rb +14 -3
- data/spec/unit/fixture_spec.rb +43 -6
- data/spec/unit/fixtures/manager_spec.rb +31 -12
- data/spec/unit/fixtures/modifiers/path_spec.rb +2 -2
- data/spec/unit/fixtures/modifiers/relative_path_spec.rb +23 -0
- data/spec/unit/waiter_spec.rb +65 -31
- metadata +25 -19
@@ -2,43 +2,37 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Arya Stark","cat_name":"Max"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at:
|
44
|
-
recorded_with: VCR 2.
|
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:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"<%= cat_owner %>","cat_name":"Max"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at: Mon,
|
44
|
-
recorded_with: VCR 2.
|
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:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Bran Stark","cat_name":"Max"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at:
|
44
|
-
recorded_with: VCR 2.
|
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:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Daenerys Targaryen","cat_name":"Max"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at: Mon,
|
44
|
-
recorded_with: VCR 2.
|
37
|
+
recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
|
38
|
+
recorded_with: VCR 2.8.0
|
data/spec/fixtures/jon_snow.yml
CHANGED
@@ -2,43 +2,37 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Jon Snow","cat_name":"Felix"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at: Mon,
|
44
|
-
recorded_with: VCR 2.
|
37
|
+
recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
|
38
|
+
recorded_with: VCR 2.8.0
|
data/spec/fixtures/ned_stark.yml
CHANGED
@@ -2,43 +2,37 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Ned Stark","cat_name":"Max"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at:
|
44
|
-
recorded_with: VCR 2.
|
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:
|
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;
|
21
|
-
|
22
|
-
-
|
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
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
-
|
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:
|
34
|
+
encoding: UTF-8
|
41
35
|
string: '{"cat_owner":"Robb Stark","cat_name":"Felix"}'
|
42
36
|
http_version:
|
43
|
-
recorded_at:
|
44
|
-
recorded_with: VCR 2.
|
37
|
+
recorded_at: Mon, 13 Jan 2014 21:01:47 GMT
|
38
|
+
recorded_with: VCR 2.8.0
|
data/spec/spec_helper.rb
CHANGED
@@ -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[
|
9
|
-
Dir[
|
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 =
|
12
|
+
Capybara.app = TestApp
|
12
13
|
Capybara.default_driver = :selenium
|
13
|
-
HTTPI.log =
|
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 =
|
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
|
@@ -18,7 +18,10 @@ shared_examples 'when a custom fixture is applied' do
|
|
18
18
|
{
|
19
19
|
fixture: 'blank',
|
20
20
|
options: {
|
21
|
-
erb: {
|
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
|
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
|
-
|
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
|
-
|
43
|
+
"http://#{request.host}:#{request.port}/api/cat/felix"
|
28
44
|
).body
|
29
45
|
end
|
30
46
|
|
31
|
-
get '/' do
|
32
|
-
|
33
|
-
end
|
47
|
+
get '/api/cat/max' do
|
48
|
+
content_type :json
|
34
49
|
|
35
|
-
|
36
|
-
|
50
|
+
{
|
51
|
+
cat_owner: 'Arya Stark',
|
52
|
+
cat_name: 'Max'
|
53
|
+
}.to_json
|
37
54
|
end
|
38
55
|
|
39
|
-
get '/
|
40
|
-
|
41
|
-
end
|
56
|
+
get '/api/cat/felix' do
|
57
|
+
content_type :json
|
42
58
|
|
43
|
-
|
44
|
-
|
59
|
+
{
|
60
|
+
cat_owner: 'Jon Snow',
|
61
|
+
cat_name: 'Felix'
|
62
|
+
}.to_json
|
45
63
|
end
|
46
64
|
end
|