spec/tcr_spec.rb in tcr-0.1.2 vs spec/tcr_spec.rb in tcr-0.1.3
- old
+ new
@@ -31,10 +31,14 @@
end
it "defaults to erroring on read/write mismatch access" do
TCR.configuration.block_for_reads.should be_falsey
end
+
+ it "defaults to hit all to false" do
+ TCR.configuration.hit_all.should be_falsey
+ end
end
describe ".configure" do
it "configures cassette location" do
expect {
@@ -51,10 +55,16 @@
it "configures allowing a blocking read mode" do
expect {
TCR.configure { |c| c.block_for_reads = true }
}.to change{ TCR.configuration.block_for_reads }.from(false).to(true)
end
+
+ it "configures to check if all sesstions was hit" do
+ expect {
+ TCR.configure { |c| c.hit_all = true }
+ }.to change{ TCR.configuration.hit_all }.from(false).to(true)
+ end
end
it "raises an error if you connect to a hooked port without using a cassette" do
TCR.configure { |c| c.hook_tcp_ports = [2525] }
expect {
@@ -329,9 +339,17 @@
smtp = Net::SMTP.start("smtp.mandrillapp.com", 2525)
smtp = Net::SMTP.start("mail.smtp2go.com", 2525)
smtp = Net::SMTP.start("mail.smtp2go.com", 2525)
end
}.to raise_error(TCR::NoMoreSessionsError)
+ end
+
+ it "raises an error if you try to playback less sessions than you previously recorded" do
+ expect {
+ TCR.use_cassette("spec/fixtures/multitest-extra-smtp", hit_all: true) do
+ smtp = Net::SMTP.start("smtp.mandrillapp.com", 2525)
+ end
+ }.to raise_error(TCR::ExtraSessionsError)
end
end
end
it "replaces sockets created with Socket.tcp" do