spec/grepg/parser_spec.rb in grepg-0.0.4 vs spec/grepg/parser_spec.rb in grepg-0.0.5

- old
+ new

@@ -32,9 +32,20 @@ "user" => "kdavis" }.to_yaml) parser = GrepPage::Parser.new('-t css'.split(' ')) expect(parser.instance_variable_get(:@opts)[:user]).to eq('kdavis') end + + # Test if we get an error when no user is specified. We should tell the user + # a sample username they can use if they want to try the client out without + # creating an account + it "errors when no user is specified" do + expect(File).to receive(:exist?).and_return(false) + expect do + output = GrepPage::Parser.new('-t css'.split(' ')) + expect(output).to match(/Missing --user parameter.*--user.*"/) + end.to raise_error(SystemExit) + end end end describe '#default_file_name' do it('returns nil if ~/.grepg.yml doesnt exist') do