Sha256: 8558f84c6ab66e14c027658c593af9f69c39b0b81a544ff90bfd5cc1894a207f

Contents?: true

Size: 397 Bytes

Versions: 20

Compression:

Stored size: 397 Bytes

Contents

module RSpecCandy
  module Helpers
    module StubExisting

      def stub_existing(attrs)
        attrs.each do |method, value|
          if respond_to?(method, true)
            stub(method => value)
          else
            raise "Attempted to stub non-existing method ##{method} on #{inspect}"
          end
        end
      end

      Object.send(:include, self)
      
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rspec_candy-0.5.1 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.5.0 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.4.1 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.4.0 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.3.1 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.3.0 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.10 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.9 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.8 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.7 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.6 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.5 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.4 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.3 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.2 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.1 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.2.0 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.1.2 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.1.1 lib/rspec_candy/helpers/stub_existing.rb
rspec_candy-0.1.0 lib/rspec_candy/helpers/stub_existing.rb