Sha256: 531e57f4ba96408b1b17d00c871867a945e8aefb8a4b1e19f327b5837909ac3c

Contents?: true

Size: 653 Bytes

Versions: 30

Compression:

Stored size: 653 Bytes

Contents

module RSpec
  shared_examples 'a chef sugar' do
    it 'acts as a singleton' do
      described_class.module_eval("def foo; 'result'; end")
      klass = Class.new.tap { |k| k.send(:include, described_class) }
      expect(described_class.foo).to eq(klass.new.foo)
    end

    described_class.instance_methods.each do |name|
      it "defines a `#{name}` DSL method" do
        expect(Chef::Sugar::DSL).to be_method_defined(name)
      end

      it 'has n-1 arity from the parent method' do
        method = Chef::Sugar::DSL.instance_method(name)
        expect(method.arity).to eq(described_class.method(name).arity - 1)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
chef-sugar-ng-4.2.2 spec/support/shared_examples.rb
chef-sugar-4.2.1 spec/support/shared_examples.rb
chef-sugar-4.2.0 spec/support/shared_examples.rb
chef-sugar-4.1.0 spec/support/shared_examples.rb
chef-sugar-4.0.1 spec/support/shared_examples.rb
chef-sugar-4.0.0 spec/support/shared_examples.rb
chef-sugar-3.6.0 spec/support/shared_examples.rb
chef-sugar-3.5.0 spec/support/shared_examples.rb
chef-sugar-3.4.0 spec/support/shared_examples.rb
chef-sugar-3.3.0 spec/support/shared_examples.rb
chef-sugar-3.2.0 spec/support/shared_examples.rb
chef-sugar-3.1.1 spec/support/shared_examples.rb
chef-sugar-3.1.0 spec/support/shared_examples.rb
chef-sugar-3.0.1 spec/support/shared_examples.rb
chef-sugar-3.0.0 spec/support/shared_examples.rb
chef-sugar-2.5.0 spec/support/shared_examples.rb
chef-sugar-2.4.1 spec/support/shared_examples.rb
chef-sugar-2.4.0 spec/support/shared_examples.rb
chef-sugar-2.3.2 spec/support/shared_examples.rb
chef-sugar-2.3.1 spec/support/shared_examples.rb