test/hexlet/member_cli_test.rb in hexlet-0.1.0 vs test/hexlet/member_cli_test.rb in hexlet-0.1.1

- old
+ new

@@ -18,6 +18,33 @@ assert { File.file?(config_file) } end assert_requested stub end + + def test_fetch + stub = stub_request(:get, @router.api_member_lesson_backend_url("my_super", "exercise")). + to_return(:status => 200) + + FakeFS do + result = Hexlet::MemberCLI.start ["fetch", "my_super", "exercise", "--verbose"] + assert { result } + end + + assert_requested stub + end + + def test_submit + stub = stub_request(:post, @router.api_member_lesson_backend_results_url("my_super", "exercise")). + to_return(:status => 201) + Open3.stubs(:capture3).returns(["", "", 0]) + + FakeFS do + folder = "my_super_lesson/exercise" + FileUtils.mkdir_p(folder) + result = Hexlet::MemberCLI.start ["submit", folder, "--verbose"] + assert { result } + end + + assert_requested stub + end end