File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 44 it "has a version number" do
55 expect ( Rails ::Diff ::VERSION ) . not_to be nil
66 end
7- end
7+
8+ describe ".generated" do
9+ before do
10+ allow ( Rails ::Diff ) . to receive ( :system! ) . and_return ( true )
11+ allow ( Rails ::Diff ) . to receive ( :ensure_template_app_exists )
12+ allow ( Rails ::Diff ) . to receive ( :install_app_dependencies )
13+ allow ( Rails ::Diff ) . to receive ( :generated_files ) . and_return ( [ "file1.rb" , "file2.rb" ] )
14+ allow ( Rails ::Diff ) . to receive ( :diff_with_header ) . and_return ( "file1.rb diff:\n ===\n Diff content" )
15+ end
16+
17+ it "returns the diff for generated files" do
18+ result = Rails ::Diff . generated ( "model" , "User" , no_cache : true )
19+ expect ( result ) . to include ( "file1.rb diff:" )
20+ end
21+ end
22+
23+ describe Rails ::Diff ::CLI do
24+ describe "#generated" do
25+ before do
26+ allow ( Rails ::Diff ) . to receive ( :system! ) . and_return ( true )
27+ allow ( Rails ::Diff ) . to receive ( :generated ) . and_return ( "file1.rb diff:\n ===\n Diff content" )
28+ end
29+
30+ it "runs without error" do
31+ cli = Rails ::Diff ::CLI . new
32+ expect { cli . generated ( "model" , "User" ) } . not_to raise_error
33+ end
34+ end
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments