Is this the correct way of testing the script?
assert_equal(calculate("Degree", "Sin", 90), Math.sin(90 * Math.PI/180))
This tests if your function behaves identical to the standard library. Not if it behaves the way you expect it to behave. It is better to hardcode the expected result:
assert_equal(calculate("Degree", "Sin", 90), 1.0)
how am I supposed to write tests for scripts that interact with the web?
Unit tests should be as independent from other components as possible.
When you have your unit-test go online and do a network request, you are not just testing your code, but also your internet connection and the service you interact with. That's an integration test, not a unit test. The problem with such tests is that if they fail, you never know if it's your code which is to blame, your internet connection which doesn't work or an error in the service you interact with.
In a good unit test you minimize dependencies to other resources as much as possible. A common method for this are mock objects. A mock object is an object which looks and behaves identical to an object which abstracts an external resource (like a network connection or database connection object), but instead of actually doing a network request it just pretends to do one and returns a hardcoded result. This allows you to test if your code performs correctly without dependency on the 3rd party service.
In order to allow your unit tests to test your code with a mock network connection instead of a real one, you need to follow a development methodology called dependency injection. This methodology means that whenever an object has a dependency on a resource, it doesn't acquire that resource itself but instead gets that object handed to it from the outside. This allows your production code to supply a real network connection and your test code to supply a mock network connection.
The nice thing about mock network connections is that you can implement many different ones with different behaviors. This allows you to implement tests for your error handling in the case that the server does not behave as it usually does. You can, for example, test how your code behaves when the server suddenly closes the connection, responds with an error message or responds with total garbage.