Closed iandouglas closed 4 years ago
User story seems to be a bit vague - I'm assuming it should read: As an authenticated user, When I visit the discover page I can click on "Find Top-Rated Movies", I should be taken to the movies page
based on the wire frames
Using a button_to causing several issues:
Solution 1: We can use the link_to method and then style the link to be a button because then we can just pass in a query string and the parameters will be populated OR Solution 2: Try to pass button_to a parameter and code in that the button is a get method
This resource shows how to write in the query params: https://stackoverflow.com/questions/25767571/rails-button-to-parameter-confusion
https://travis-ci.org/github/Kathybui732/viewing_party/builds/719807183
The CI build is attempting to parse an HTML 500 response as a JSON.
1) As an authenticated user On Discover Page I can go to movie index page from the discover page
Failure/Error: JSON.parse(response.body, symbolize_names: true)
JSON::ParserError:
784: unexpected token at '<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>openresty</center>
</body>
</html>
'
# ./app/controllers/movies_controller.rb:16:in `parse_body'
# ./app/controllers/movies_controller.rb:20:in `block in movies_results'
# ./app/controllers/movies_controller.rb:28:in `top_rated_movies'
# ./app/controllers/movies_controller.rb:3:in `index'
# ./spec/features/movies/link_from_discover_spec.rb:13:in `block (4 levels) in <top (required)>'
# ./spec/features/movies/link_from_discover_spec.rb:12:in `block (3 levels) in <top (required)>'
2) Top Rated Results Spec When I click the button to discover top rated movies There are 40 results of Movies
# same error and similar stack trace
https://travis-ci.org/github/Kathybui732/viewing_party/builds/719807183
The CI build is attempting to parse an HTML 500 response as a JSON.
I'm not really sure what the approach is, as my dev tests are all passing (screenshot)
I'm going to try specifying the content-type in the conn header source: Detailed HTTP Requests
conn = Faraday.new(
url: 'http://sushi.com',
params: {param: '1'},
headers: {'Content-Type' => 'application/json'}
)
The CI check is still getting the 500 html error.
JSON::ParserError: 784: unexpected token at '<html>
That is what I am searching the internet for now.
I think a better approach also would be to create some exception handling - stackoverflow
I can rescue the error and then the program execution can continue.
begin
...
JSON.parse(response.body)
rescue JSON::ParserError
# Handle error
end
As an authenticated user, When I click on "Find Top-Rated Movies", I should be taken to the movies page #11
Details: To get the top-rated movies the application will be consuming The MovieDB API