```ruby
require File.expand_path('../../../spec_helper', __FILE__)

describe "ARGF.set_encoding" do
  before :each do
    @file = fixture __FILE__, "file1.txt"
  end

  after :each do
    ARGF.close unless ARGF.closed?
  end

  it "sets the external encoding when passed an encoding instance" do
    argv [@file] do
      ARGF.set_encoding Encoding::UTF_8
      ARGF.gets.encoding.should == Encoding::UTF_8
    end
  end

  it "sets the external encoding when passed an encoding name" do
    argv [@file] do
      ARGF.set_encoding "utf-8"
      ARGF.gets.encoding.should == Encoding::UTF_8
    end
  end

  it "sets the external, internal encoding when passed two encoding instances" do
    argv [@file] do
      ARGF.set_encoding Encoding::UTF_8, Encoding::EUC_JP
      ARGF.gets.encoding.should == Encoding::EUC_JP
    end
  end

  it "sets the external, internal encoding when passed 'ext:int' String" do
    argv [@file] do
      ARGF.set_encoding "utf-8:euc-jp"
      ARGF.gets.encoding.should == Encoding::EUC_JP
    end
  end
end
```

Fix remaining ARGF flaky tests by isolating ARGF.set_encoding.
user
```ruby
require File.expand_path('../../../spec_helper', __FILE__)

# These specs need to be run to a separate process as there is no way to reset ARGF encoding
describe "ARGF.set_encoding" do
  before :each do
    @file = fixture __FILE__, "file1.txt"
  end

  after :each do
    ARGF.close unless ARGF.closed?
  end

  it "sets the external encoding when passed an encoding instance" do
    enc = ruby_exe('ARGF.set_encoding(Encoding::UTF_8); print ARGF.gets.encoding', args: [@file])
    enc.should == "UTF-8"
  end

  it "sets the external encoding when passed an encoding name" do
    enc = ruby_exe('ARGF.set_encoding("utf-8"); print ARGF.gets.encoding', args: [@file])
    enc.should == "UTF-8"
  end

  it "sets the external, internal encoding when passed two encoding instances" do
    enc = ruby_exe('ARGF.set_encoding(Encoding::UTF_8, Encoding::EUC_JP); print ARGF.gets.encoding', args: [@file])
    enc.should == "EUC-JP"
  end

  it "sets the external, internal encoding when passed 'ext:int' String" do
    enc = ruby_exe('ARGF.set_encoding("utf-8:euc-jp"); print ARGF.gets.encoding', args: [@file])
    enc.should == "EUC-JP"
  end
end
```
assistant