Sha256: 690c74d35fd8f3bad92596cbd501c55f653de85a67ebb45aa618381c8ae3edfd
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' module Grape module DSL module HelpersSpec class Dummy include Grape::DSL::Helpers # rubocop:disable TrivialAccessors def self.mod namespace_stackable(:helpers).first end # rubocop:enable TrivialAccessors end end describe Helpers do subject { Class.new(HelpersSpec::Dummy) } let(:proc) do lambda do |*| def test :test end end end describe '.helpers' do it 'adds a module with the given block' do expect(subject).to receive(:namespace_stackable).with(:helpers, kind_of(Grape::DSL::Helpers::BaseHelper)).and_call_original expect(subject).to receive(:namespace_stackable).with(:helpers).and_call_original subject.helpers(&proc) expect(subject.mod.instance_methods).to include(:test) end it 'uses provided modules' do mod = Module.new expect(subject).to receive(:namespace_stackable).with(:helpers, kind_of(Grape::DSL::Helpers::BaseHelper)).and_call_original expect(subject).to receive(:namespace_stackable).with(:helpers).and_call_original subject.helpers(mod, &proc) expect(subject.mod).to eq mod end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-0.13.0 | spec/grape/dsl/helpers_spec.rb |
grape-0.12.0 | spec/grape/dsl/helpers_spec.rb |