Sha256: ccf7851b78fcf263933632392e4afaceb4e1d3875e3294527e51d221a0c4201b

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

describe Lita::Handlers::GithubPrList, lita_handler: true do
  before :each do
    Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
    Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
  end

  let(:pull_request_review_comment) { File.read("spec/fixtures/pull_request_review_comment.json") }
  let(:edit_comment_response_content) { [File.read("spec/fixtures/edit_comment.json")] }
  let(:edit_comment_response) { Rack::Response.new(edit_comment_response_content, 200, { 'Content-Type' => 'json' }) }
  let(:check_list) do
    "- [ ] Change log
    - [ ] Demo page
    - [ ] Product owner signoff
    - [ ] Merge into master
    - [ ] Deploy to production"
  end

  it { routes_http(:post, "/check_list").to(:check_list) }

  it "mentions the github user in the room and tell them the check list was added to the pull request" do
    allow_any_instance_of(Octokit::Client).to receive(:update_comment).and_return(edit_comment_response)
    request = Rack::Request.new("rack.input" => StringIO.new(pull_request_review_comment))
    response = Rack::Response.new(['Hello'], 200, {'Content-Type' => 'text/plain'})

    github_handler = Lita::Handlers::GithubPrList.new
    github_handler.check_list(request, response)
    expect(edit_comment_response.body.first).to include(check_list)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-github_pr_list-0.0.7 spec/lita/handlers/check_list_spec.rb