test/models/hook_test.rb in shipit-engine-0.3.1 vs test/models/hook_test.rb in shipit-engine-0.4.0

- old
+ new

@@ -5,10 +5,16 @@ @stack = stacks(:shipit) @hook = hooks(:shipit_deploys) end test "#url must be valid" do + @hook.url = 'file:/ad"fa/adfa' + refute @hook.valid? + assert_equal ['Url is not a valid URL'], @hook.errors.full_messages + end + + test "#url must not be localhost" do @hook.url = 'file:///etc/passwd' refute @hook.valid? assert_equal ['Url is not a valid URL'], @hook.errors.full_messages end @@ -26,11 +32,11 @@ assert_enqueued_with(job: EmitEventJob) do Hook.emit(:deploy, @stack, foo: 42) end end - test ".deliver schedule a delivery for each matching hook" do + test ".deliver schedules a delivery for each matching hook" do assert_difference -> { Delivery.count }, 2 do Hook.deliver(:deploy, @stack, 'foo' => 42) end delivery = Delivery.last @@ -39,10 +45,10 @@ assert_equal 'application/x-www-form-urlencoded', delivery.content_type assert_equal 'foo=42', delivery.payload assert_equal 'scheduled', delivery.status end - test ".scoped? returns true if the hook have a stack_id" do + test ".scoped? returns true if the hook has a stack_id" do @hook.stack_id = nil refute @hook.scoped? @hook.stack_id = 42 assert @hook.scoped?