Sha256: 3a539d7e4fc22a6cbdfa427c7740c554eb0b1f5e0e3c3ff218b91d583b01969c

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

describe Redis::Scripting::Module do
  let(:redis) { double('Redis') }
  let(:source_dir) { File.dirname(__FILE__) + "/scripts" }
  let(:subject) { Redis::Scripting::Module.new(redis, source_dir) }

  its(:source_dir) { should == source_dir }
  its(:redis) { should == redis }

  describe "#run" do
    it "should raise on unknown" do
      expect { subject.run(:whut, [], []) }.to raise_error(ArgumentError)
    end

    it "should use initializer redis by default" do
      expect(redis).to receive(:evalsha) { 1 }
      subject.run(:test1, [], []).should == 1
    end

    it "should use the given redis" do
      redis2 = double('Redis2')
      expect(redis2).to receive(:evalsha) { 1 }
      subject.run(:test1, [], [], redis2).should == 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-scripting-1.0.1 spec/redis/scripting/module_spec.rb