File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
spec/bounded_contexts/booking/application/controllers Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ require "rails_helper"
2
+
3
+ module Booking
4
+ module Application
5
+ module Controllers
6
+ RSpec . describe CargoBookingsController , type : :request do
7
+ let ( :repo ) { Infrastructure ::Repositories ::CargoRepository . new }
8
+ let ( :path ) { "/bookings" }
9
+ let ( :params ) {
10
+ {
11
+ booking_amount : 1 ,
12
+ origin_location : "ATH" ,
13
+ dest_location : "HAM" ,
14
+ dest_arrival_deadline : Time . now . iso8601
15
+ }
16
+ }
17
+ let ( :do_request ) { post path , params : params }
18
+
19
+ it "responds with the correct http response" do
20
+ do_request
21
+ expect ( response . status ) . to eq 200
22
+ end
23
+
24
+ it "responds with the correct body" do
25
+ do_request
26
+
27
+ json = JSON . parse ( response . body )
28
+ expect ( json [ "value" ] ) . to be_present
29
+ expect ( repo . get_by_booking_id ( json [ "value" ] ) ) . to be_a ( Domain ::Aggregates ::Cargo )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments