Sha256: a96095b96b8c9efb8669bf6cfe3acf17ac16260b983c1e00ece6dd3c1d2f3c56
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'method_log/method_definition' require 'method_log/source_file' describe MethodLog::MethodDefinition do let(:source_file) do MethodLog::SourceFile.new(path: 'path/to/source.rb', source: %{ class Foo def bar # implementation end end }.strip) end it 'is equal to another method definition with same source file and line numbers' do definition_one = MethodLog::MethodDefinition.new(source_file: source_file, lines: 1..3) definition_two = MethodLog::MethodDefinition.new(source_file: source_file, lines: 1..3) expect(definition_one).to eq(definition_two) end it 'has same hash as another method definition with same path and line numbers' do definition_one = MethodLog::MethodDefinition.new(source_file: source_file, lines: 1..3) definition_two = MethodLog::MethodDefinition.new(source_file: source_file, lines: 1..3) expect(definition_one.hash).to eq(definition_two.hash) end it 'provides access to the method source' do definition = MethodLog::MethodDefinition.new(source_file: source_file, lines: 1..3) expect(definition.source).to eq(%{ def bar\n # implementation\n end}) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
method_log-0.0.5 | spec/method_definition_spec.rb |
method_log-0.0.4 | spec/method_definition_spec.rb |
method_log-0.0.3 | spec/method_definition_spec.rb |