Sha256: 9d0959514bbd30f599b8d18743f07a9759b66f601326b55656c3149817b0d172

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

module RSpec::Matchers
  def __method_with_super
    super
  end

  module ModThatIncludesMatchers
    include RSpec::Matchers
  end

  RSpec.configure do |c|
    c.include RSpec::Matchers, :include_rspec_matchers => true
    c.include ModThatIncludesMatchers, :include_mod_that_includes_rspec_matchers => true
  end

  RSpec.describe self do
    shared_examples_for "a normal module with a method that supers" do
      it "raises the expected error (and not SystemStackError)" do
        expect { __method_with_super }.to raise_error(NoMethodError) # there is no __method_with_super in an ancestor
      end
    end

    it_behaves_like "a normal module with a method that supers"

    context "when RSpec::Matchers has been included in an example group" do
      include RSpec::Matchers
      it_behaves_like "a normal module with a method that supers"
    end

    context "when a module that includes RSpec::Matchers has been included in an example group" do
      include RSpec::Matchers::ModThatIncludesMatchers
      it_behaves_like "a normal module with a method that supers"
    end

    context "when RSpec::Matchers is included via configuration", :include_rspec_matchers => true do
      it_behaves_like "a normal module with a method that supers"
    end

    context "when RSpec::Matchers is included in a module that is included via configuration", :include_mod_that_includes_rspec_matchers => true do
      it_behaves_like "a normal module with a method that supers"
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
opal-rspec-0.6.2 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.6.1 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.6.0 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.6.0.beta1 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-connect-rspec-0.5.0 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.5.0 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.5.0.beta3 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.5.0.beta2 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
opal-rspec-0.5.0.beta1 rspec-core/spec/rspec/core/rspec_matchers_spec.rb
rspec-core-3.0.0.beta2 spec/rspec/core/rspec_matchers_spec.rb