Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests that work

  • Loading branch information...
commit 0831d354827463fadfb42ad7aef0ad1ab08cbfa5 1 parent 5c1afe5
@dkowis dkowis authored
View
27 betamax-proxy/src/test/groovy/co/freeside/betamax/proxy/matchRules/CustomMatcherSpec.groovy
@@ -3,6 +3,7 @@ package co.freeside.betamax.proxy.matchRules
import co.freeside.betamax.ProxyConfiguration
import co.freeside.betamax.Recorder
import co.freeside.betamax.TapeMode
+import com.google.common.io.Files
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
@@ -63,4 +64,30 @@ class CustomMatcherSpec extends Specification {
content == "Hey look some text: BUTTS"
}
+
+ void "Using a custom matcher it should record a new one"() {
+ given:
+ def tapeRoot = Files.createTempDir() //Using a temp dir this time
+ def imr = new InstrumentedMatchRule()
+ def proxyConfig = ProxyConfiguration.builder()
+ .sslEnabled(true)
+ .tapeRoot(tapeRoot)
+ .defaultMode(TapeMode.READ_WRITE)
+ .defaultMatchRule(imr)
+ .build()
+
+ def recorder = new Recorder(proxyConfig)
+ recorder.start("httpBinTape")
+ when:
+ def response = simplePost("https://httpbin.org/post", "LOLWUT")
+ then:
+ def content = response.toString()
+ recorder.stop()
+ //The tape is written when it's referenced not in this dir
+ //make sure there's a file in there
+ def recordedTape = new File(tapeRoot, "httpBinTape.yaml")
+ //It should have recorded it to the tape
+ recordedTape.exists()
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.