Sha256: 53eee33c11d6713bf0b881d136152001c924c8ceef13f62b5b2ef74437c02884
Contents?: true
Size: 1.07 KB
Versions: 59
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe "a matcher defined using the matcher DSL" do def question? :answer end it "has access to methods available in the scope of the example" do RSpec::Matchers::define(:ignore) {} ignore.question?.should eq(:answer) end it "raises when method is missing from local scope as well as matcher" do RSpec::Matchers::define(:ignore) {} expect { ignore.i_dont_exist }.to raise_error(NameError) end it "clears user instance variables between invocations" do RSpec::Matchers::define(:be_just_like) do |expected| match do |actual| @foo ||= expected @foo == actual end end 3.should be_just_like(3) 4.should be_just_like(4) end describe "#respond_to?" do it "returns true for methods in example scope" do RSpec::Matchers::define(:ignore) {} ignore.should respond_to(:question?) end it "returns false for methods not defined in matcher or example scope" do RSpec::Matchers::define(:ignore) {} ignore.should_not respond_to(:i_dont_exist) end end end
Version data entries
59 entries across 59 versions & 5 rubygems