spec/support/github_helpers.rb in git_reflow-0.4.2 vs spec/support/github_helpers.rb in git_reflow-0.5.0

- old
+ new

@@ -51,36 +51,37 @@ github_server = GitReflow::GitServer::GitHub.new github_server.class.stub(:user).and_return(user) github_server.class.stub(:oauth_token).and_return(oauth_token_hash.token) github_server.class.stub(:site_url).and_return(site_url) github_server.class.stub(:api_endpoint).and_return(api_endpoint) - github_server.stub(:remote_user).and_return(user) - github_server.stub(:remote_repo).and_return(repo) - github_server.stub(:oauth_token).and_return(oauth_token_hash.token) - github_server.stub(:get_commited_time).and_return(Time.now) + github_server.class.stub(:remote_user).and_return(user) + github_server.class.stub(:remote_repo).and_return(repo) + github_server.class.stub(:oauth_token).and_return(oauth_token_hash.token) + github_server.class.stub(:get_commited_time).and_return(Time.now) GitReflow.stub(:git_server).and_return(github_server) # Stubbing statuses for a given commit + stub_request(:get, %r{#{GitReflow.git_server.class.api_endpoint}/repos/#{user}/commits/\w+}). + to_return(:body => fixture('repositories/commit.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) stub_request(:get, %r{#{GitReflow.git_server.class.api_endpoint}/repos/#{user}/commits/\w+/statuses?}). to_return(:body => fixture('pull_requests/pull_requests.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) if pull # Stubbing review - github.pull_requests.stub(:create).with(user, repo, pull.except('state')).and_return(Hashie::Mash.new(:number => '1', :title => pull['title'], :html_url => "https://github.com/#{user}/#{repo}/pulls/1")) stub_post("/repos/#{user}/#{repo}/pulls"). to_return(:body => pull.to_s, :status => 201, :headers => {:content_type => "application/json\; charset=utf-8"}) # Stubbing pull request finder stub_get("/repos/#{user}/pulls").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0', 'base' => 'master', 'head' => "#{user}:#{branch}", 'state' => 'open'}). to_return(:body => fixture('pull_requests/pull_requests.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) stub_get("/repos/#{user}/#{repo}/pulls").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0', 'base' => 'master', 'head' => "#{user}:#{branch}", 'state' => 'open'}). to_return(:body => fixture('pull_requests/pull_requests.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) # Stubbing pull request comments - stub_get("/repos/#{user}/pulls/#{pull[:number]}/comments?").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0'}). + stub_get("/repos/#{user}/pulls/#{pull.number}/comments?").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0'}). to_return(:body => fixture('pull_requests/comments.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) # Stubbing issue comments - stub_get("/repos/#{user}/issues/#{pull[:number]}/comments?").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0'}). + stub_get("/repos/#{user}/issues/#{pull.number}/comments?").with(:query => {'access_token' => 'a1b2c3d4e5f6g7h8i9j0'}). to_return(:body => fixture('issues/comments.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"}) end github_server end