Skip to content

Instantly share code, notes, and snippets.

@nwjsmith
Created January 28, 2014 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwjsmith/8677410 to your computer and use it in GitHub Desktop.
Save nwjsmith/8677410 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'open3'
describe 'unnest' do
it 'can unnest nested class definitions in a file' do
example_input = <<-EOF
module A::B
class C::D::E < F::G
def initialize(foo)
@foo = foo
end
end
end
EOF
ENV['PATH'] = "./bin/:#{ENV['PATH']}"
capture, status = Open3.capture2e('unnest', stdin_data: example_input)
expected_output = <<-EOF
module A
module B
module C
module D
class E < F::G
def initialize(foo)
@foo = foo
end
end
end
end
end
end
EOF
expect(capture).to eq expected_output
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment