File: makes_substitute_methods_spec.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 (24 lines) | stat: -rw-r--r-- 697 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper'

module Bogus
  describe MakesSubstituteMethods do
    class SampleForCopyingMethods
      def self.foo(name, value = "hello", *rest, &block)
        "this is the method body"
      end
    end

    let(:method_stringifier) { isolate(MethodStringifier) }
    let(:makes_substitute_methods) { isolate(MakesSubstituteMethods) }

    it "makes a copy of the method with its params and adds recording" do
      copy = makes_substitute_methods.stringify(SampleForCopyingMethods.method(:foo))

      expect(copy).to eq <<-EOF
      def foo(name, value = Bogus::DefaultValue, *rest, &block)
        __record__(:foo, name, value, *rest, &block)
      end
      EOF
    end
  end
end