spec/lol/client_spec.rb in ruby-lol-0.9.12 vs spec/lol/client_spec.rb in ruby-lol-0.9.13

- old
+ new

@@ -17,33 +17,34 @@ it "defaults on EUW as a region" do expect(subject.region).to eq("euw") end - it "sets caching if redis is specified in the options" do - client = Client.new "foo", redis: "redis://dummy-url" - expect(client.cached?).to be_true - end + context "caching" do + let(:client) { Client.new "foo", redis: "redis://dummy-url" } + let(:real_redis) { Client.new "foo", redis: "redis://localhost:6379" } - it "sets a default ttl of 15 * 60s" do - client = Client.new "foo", redis: "redis://dummy-url" - expect(client.ttl).to eq(15*60) - end + it "sets caching if redis is specified in the options" do + expect(client.cached?).to be_true + end - it "accepts a custom ttl" do - client = Client.new "foo", redis: "redis://dummy-url", ttl: 10 - expect(client.ttl).to eq(10) - end + it "sets a default ttl of 15 * 60s" do + expect(client.ttl).to eq(15*60) + end - it "instantiates a redis client if redis is in the options" do - client = Client.new "foo", redis: "redis://localhost:6379" - expect(client.instance_variable_get(:@redis)).to be_a(Redis) - end + it "accepts a custom ttl" do + client = Client.new "foo", redis: "redis://dummy-url", ttl: 10 + expect(client.ttl).to eq(10) + end - it "passes the redis_store to the request" do - client = Client.new "foo", redis: "redis://localhost:6379" - champion_request = client.champion - expect(champion_request.cache_store).to eq(client.cache_store) + it "instantiates a redis client if redis is in the options" do + expect(real_redis.instance_variable_get(:@redis)).to be_a(Redis) + end + + it "passes the redis_store to the request" do + champion_request = real_redis.champion + expect(champion_request.cache_store).to eq(real_redis.cache_store) + end end end describe "#cached?" do it "is true if @cached is true" do