Sha256: 6ff550776da49e69059161e63c9d125080fed72dd6b8182be7efc1d344ffbb76
Contents?: true
Size: 1.35 KB
Versions: 15
Compression:
Stored size: 1.35 KB
Contents
require 'spec_helper' require 'scorpion/rspec' load 'scorpion/rspec/helper.rb' Scorpion::Rspec.prepare do hunt_for Numeric, return: 42 end module ScorpionRspecHelperSpec class Food include Scorpion::Object end 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 ) capture( :food, ScorpionRspecHelperSpec::Food ) 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 } specify{ expect( scorpion.fetch ScorpionRspecHelperSpec::Food ).to be food } 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
15 entries across 15 versions & 1 rubygems