Sha256: 9d41a5638e407d338dd6b1d60bad7d0644cd8780932352b5deb27176a7c9985d
Contents?: true
Size: 1.14 KB
Versions: 10
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' require 'scorpion/rspec' load 'scorpion/rspec/helper.rb' Scorpion::Rspec.prepare do hunt_for Numeric, return: 42 end describe Scorpion::Rspec::Helper do include Scorpion::Rspec::Helper scorpion do hunt_for String, return: "Shazam!" end it "provides a scorpion" do expect( scorpion ).not_to be_nil end it "is configurable" do expect( scorpion.fetch String ).to eq "Shazam!" end it "inherits global config" do expect( scorpion.fetch Numeric ).to eq 42 end context "hunting" do hunt( :number, Numeric, 5 ) hunt( :string, String ) { "hello" } hunt( :double, Regexp ) specify{ expect( scorpion.fetch Numeric ).to eq 5 } specify{ expect( scorpion.fetch String ).to eq "hello" } specify{ expect( scorpion.fetch Regexp ).to be_a RSpec::Mocks::TestDouble } end context "child context" do it "inherits" do expect( scorpion.fetch String ).to eq "Shazam!" end context "overrides" do scorpion do hunt_for String, return: "KaPow" end it "overrides" do expect( scorpion.fetch String ).to eq "KaPow" end end end end
Version data entries
10 entries across 10 versions & 1 rubygems