require 'spec_helper' describe Evrone::CI::Router::Middleware::FetchCommitInfo do let(:build) { create :build } let(:env) { OpenStruct.new build: build, scm: scm } let(:app) { ->(_) { 0 } } let(:commit_info) { 'commit_info' } let(:scm) { 'scm' } subject { described_class.new(app).call env } before do mock(scm).commit_info { commit_info } end it { should eq 0 } it "should assign commit info to build" do subject expect(build.commit_info).to eq commit_info end end