diff --git a/lib/utils/reacter.rb b/lib/utils/reacter.rb index bd3d3df..45ff883 100644 --- a/lib/utils/reacter.rb +++ b/lib/utils/reacter.rb @@ -1,4 +1,5 @@ require 'octokit' +require_relative '../config' # Queries, opens and closes issues in a given repository class ReactBot diff --git a/lib/utils/reporter.rb b/lib/utils/reporter.rb index 1778bb8..5677ec6 100644 --- a/lib/utils/reporter.rb +++ b/lib/utils/reporter.rb @@ -1,4 +1,5 @@ require_relative 'queries' +require_relative '../config' require 'octokit' Dotenv.load('orgbot.env') @@ -6,14 +7,14 @@ # Simple Console Reporting or usage instructions class Reporter def initialize - @prompt = TTY::Prompt.new @c = Octokit::Client.new(access_token: @t) @r = ENV['REPO'] @t = ENV['TOKEN'] end def welcome - puts @c.say("Sup #{Query.new.user}") + c = Octokit::Client.new(access_token: @t) + puts c.say("Sup #{Query.new.user}") puts "\n🤖 Welcome to GitHub Simulator!"\ 'Select how and when you would like to commit to GitHub:' end diff --git a/test/suite.rb b/test/suite.rb index 0532ea8..524d21e 100644 --- a/test/suite.rb +++ b/test/suite.rb @@ -1,9 +1,11 @@ require_relative 'test_helper' require_relative 'test_branches' +require_relative 'test_committer' require_relative 'test_config' require_relative 'test_dotenv' require_relative 'test_issues' require_relative 'test_pull_requests' require_relative 'test_queries' +require_relative 'test_reacter' require_relative 'test_reporter' require_relative 'test_utils' diff --git a/test/test_committer.rb b/test/test_committer.rb new file mode 100644 index 0000000..6634f44 --- /dev/null +++ b/test/test_committer.rb @@ -0,0 +1,16 @@ +require 'test/unit' +require_relative '../lib/config' + +Dotenv.load('orgbot.env') + +class TestCommit < Test::Unit::TestCase + def test_repo + bot = CommitBot.new(ENV['REPO'], 'master', ENV['TOKEN']) + file = 'test.txt' + content = 'cooltest' + message = 'testmessage' + assert_nothing_raised do + bot.commit(file, content, message) + end + end +end diff --git a/test/test_reacter.rb b/test/test_reacter.rb new file mode 100644 index 0000000..63540f8 --- /dev/null +++ b/test/test_reacter.rb @@ -0,0 +1,12 @@ +require 'test/unit' +require_relative '../lib/config' +require_relative '../lib/utils/reacter' + +class TestReacter < Test::Unit::TestCase + def test_react + rep = ReactBot.new(ENV['REPO'], ENV['TOKEN']) + assert_nothing_raised do + rep.randemoji(5) + end + end +end