File: fake_creator_of_fakes.rb

package info (click to toggle)
ruby-bogus 0.1.5-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 828 kB
  • ctags: 628
  • sloc: ruby: 4,124; makefile: 6; sh: 2
file content (15 lines) | stat: -rw-r--r-- 278 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class FakeCreatorOfFakes
  def create(name, opts = {}, &block)
    fake = [name, opts, block && block.call]
    fakes << fake
    fake
  end

  def fakes
    @fakes ||= []
  end

  def has_created?(name, opts = {}, klass = nil)
    fakes.include?([name, opts, klass])
  end
end