File tree Expand file tree Collapse file tree 4 files changed +36
-5
lines changed Expand file tree Collapse file tree 4 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ gem "rake"
6
6
gem "rspec"
7
7
8
8
group :development , :test do
9
+ gem "aruba" , "~> 2.1.0" , require : false
9
10
gem "byebug"
10
11
gem "guard-rspec" , require : false
11
12
@@ -17,7 +18,3 @@ group :development, :test do
17
18
gem "pry-byebug" , require : false
18
19
end
19
20
end
20
-
21
- group :test do
22
- gem "git" , require : false
23
- end
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env ruby
2
2
# frozen_string_literal: true
3
3
4
- unless File . exist? ( "./Rakefile" ) || File . exist? ( "./Gemfile" )
4
+ if ! File . exist? ( "./Rakefile" ) && ! File . exist? ( "./Gemfile" )
5
5
abort "Please run annotaterb from the root of the project."
6
6
end
7
7
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ RSpec . describe "CLI" , type : "aruba" do
4
+ context "when running in a non-Rails project directory" do
5
+ before do
6
+ # Assumes there's no Rakefile or Gemfile
7
+ run_command ( "annotaterb" )
8
+ end
9
+
10
+ let ( :error_message ) { "Please run annotaterb from the root of the project." }
11
+
12
+ it "exits and outputs an error message" do
13
+ expect ( last_command_started ) . to have_exit_status ( 1 )
14
+ expect ( last_command_started ) . to have_output_on_stderr ( error_message )
15
+ end
16
+ end
17
+
18
+ context "when running in a directory with a Rakefile and a Gemfile" do
19
+ before do
20
+ touch ( "Rakefile" , "Gemfile" )
21
+ run_command ( "annotaterb" )
22
+ end
23
+
24
+ let ( :help_banner_fragment ) { "Usage: annotaterb [command] [options]" }
25
+
26
+ it "outputs the help message" do
27
+ expect ( last_command_started ) . to be_successfully_executed
28
+ expect ( last_command_started . stdout ) . to include ( help_banner_fragment )
29
+ end
30
+ end
31
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require "aruba/rspec"
You can’t perform that action at this time.
0 commit comments