Sha256: f8a406d5d1f267e50c6b56703d84d3fca895717a9a1fea28058742499643560d

Contents?: true

Size: 745 Bytes

Versions: 10

Compression:

Stored size: 745 Bytes

Contents

require_relative 'spec_helper'

RSpec.describe 'module visibility' do
  attr_reader :clazz

  before do
    @clazz = Clazz.new
  end

  it 'can be called as an included module' do
    expect do
      clazz.process('echo stdout > /dev/stdout')
    end.to output("stdout\n").to_stdout
  end

  it 'can be called as a module method' do
    expect do
      ProcessHelper.process('echo stdout > /dev/stdout')
    end.to output("stdout\n").to_stdout
  end

  it 'does not expose private methods' do
    expect(clazz.private_methods).to include(:process_with_popen)

    expect do
      clazz.process_with_popen
    end.to raise_error(NoMethodError)

    expect do
      ProcessHelper.process_with_popen
    end.to raise_error(NoMethodError)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
process_helper-0.1.2 spec/module_visibility_spec.rb
process_helper-0.1.2.pre.beta.1 spec/module_visibility_spec.rb
process_helper-0.1.1 spec/module_visibility_spec.rb
process_helper-0.1.1.pre.beta.1 spec/module_visibility_spec.rb
process_helper-0.1.0 spec/module_visibility_spec.rb
process_helper-0.0.4 spec/module_visibility_spec.rb
process_helper-0.0.4.pre.beta.5 spec/module_visibility_spec.rb
process_helper-0.0.4.pre.beta.4 spec/module_visibility_spec.rb
process_helper-0.0.4.pre.beta.3 spec/module_visibility_spec.rb
process_helper-0.0.4.pre.beta.2 spec/module_visibility_spec.rb