File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
require "test_helper"
2
+ require "tempfile"
2
3
require_relative "../../../lib/suspenders/cleanup/organize_gemfile"
3
4
4
5
module Suspenders
@@ -7,14 +8,15 @@ class OrganizeGemfileTest < ActiveSupport::TestCase
7
8
test "organizes Gemfile by group" do
8
9
original = file_fixture ( "gemfile_messy" ) . read
9
10
modified = file_fixture ( "gemfile_clean" ) . read
10
- File . open ( "foo_file" , "w+" ) { _1 . write original }
11
11
12
- Suspenders ::Cleanup ::OrganizeGemfile . perform ( "foo_file" )
12
+ Tempfile . create "Gemfile" do |gemfile |
13
+ gemfile . write original
14
+ gemfile . rewind
13
15
14
- gemfile = File . read ( "foo_file" )
15
- assert_equal modified , gemfile
16
- ensure
17
- File . delete ( "foo_file" )
16
+ Suspenders :: Cleanup :: OrganizeGemfile . perform ( gemfile . path )
17
+
18
+ assert_equal modified , gemfile . read
19
+ end
18
20
end
19
21
end
20
22
end
You can’t perform that action at this time.
0 commit comments