Created
December 21, 2012 21:08
-
-
Save anonymous/4355858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe ApiController do | |
describe "GET build" do | |
it "kicks off a build of a project" do | |
get :build | |
user = double('user') | |
project = double('project') | |
matching_projects = double('matching_projects') | |
project_name = { :name => 'some_project' } | |
user_name = { :username => 'some_user' } | |
Project.should_receive(:where).with(project_name).and_return(matching_projects) | |
matching_projects.should_receive(:first).and_return(project) | |
end | |
end | |
end | |
##### Beginning part of #build method. | |
def build | |
project_name = params[:project_name] | |
environment_name = params[:environment_name] | |
project = Project.where(:name => project_name).first | |
user = User.where(:username => @username).first | |
# ...... | |
Failures: | |
1) ApiController GET build kicks off a build of a project | |
Failure/Error: Project.should_receive(:where).with(project_name).and_return(matching_projects) | |
(<Project(id: integer, name: string, version_control_system: string, repository_url: string, version_control_url: string, package_name: string, continuous_integration_url: string, created_at: datetime, updated_at: datetime) (class)>).where({:name=>"some_project"}) | |
expected: 1 time | |
received: 0 times | |
# ./spec/controllers/api_controller_spec.rb:14:in `block (3 levels) in <top (required)>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment