Created
January 28, 2014 22:01
-
-
Save nwjsmith/8677410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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