I come from a Python and Java background with only basic knowledge to CSS, HTML, Ruby and trying to learn web development using Ruby on Rails. I'm trying to follow the tutorial on Michael Hartl. I do not understand what arguments the post
method in Listing 7.23 is doing.
require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: "",
email: "user@invalid",
password: "foo",
password_confirmation: "bar" } }
end
assert_template 'users/new'
end
end
From what I trace in the API, it takes in 2 non-optional arguments which are both Strings, but in Listing 7.23 there is a sudden hash syntax params:
in the 2nd argument and this has confused me. Can anyone enlighten me?