Skip to content

Commit

Permalink
got rid of all references to Rails.logger
Browse files Browse the repository at this point in the history
  • Loading branch information
srushti committed Jul 13, 2011
1 parent f46adfa commit 090225f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Init
def add(url, name, branch, scm)
if Project.add(:url => url, :name => name, :branch => branch, :scm => scm)
Rails.logger.info "#{name} successfully added."
Goldberg.logger.info "#{name} successfully added."
else
Goldberg.logger.info "There was problem adding the project."
end
Expand Down
16 changes: 8 additions & 8 deletions spec/models/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
describe Init do
it "adds a new project" do
Project.should_receive(:add).with(:url => 'url', :name => 'name', :branch => 'master',:scm => 'git').and_return(true)
Rails.logger.should_receive(:info).with('name successfully added.')
Goldberg.logger.should_receive(:info).with('name successfully added.')
Init.new.add('url', 'name', 'master', 'git')
end

it "adds a new project with a custom command" do
Project.should_receive(:add).with(:url => 'url', :name => 'name', :branch => 'master',:scm => 'svn').and_return(true)
Rails.logger.should_receive(:info).with('name successfully added.')
Goldberg.logger.should_receive(:info).with('name successfully added.')
Init.new.add('url', 'name', 'master', 'svn')
end

it "reports failure in adding a project" do
Project.should_receive(:add).and_return(false)
Rails.logger.should_receive(:info).with("There was problem adding the project.")
Goldberg.logger.should_receive(:info).with("There was problem adding the project.")
Init.new.add('url', 'name', 'master','svn')
end

it "removes the specified project" do
project = Factory(:project, :name => 'name')
Rails.logger.should_receive(:info).with('name successfully removed.')
Goldberg.logger.should_receive(:info).with('name successfully removed.')
Init.new.remove('name')
Project.find_by_id(project.id).should_not be
end

it "fails gracefully if it can't find the project to remove" do
Rails.logger.should_receive(:error).with("Project unknown does not exist.")
Goldberg.logger.should_receive(:error).with("Project unknown does not exist.")
Init.new.remove('unknown')
end

it "lists all projects" do
project = Factory(:project, :name => 'a_project')
Rails.logger.should_receive(:info).with(project.name)
Goldberg.logger.should_receive(:info).with(project.name)
Init.new.list
end

Expand All @@ -44,8 +44,8 @@
one.stub!(:run_build).and_raise(exception)
two.should_receive(:run_build)
Project.stub!(:projects_to_build).and_return([one, two])
Rails.logger.should_receive(:error).with("Build on project #{one.name} failed because of An exception")
Rails.logger.should_receive(:error)
Goldberg.logger.should_receive(:error).with("Build on project #{one.name} failed because of An exception")
Goldberg.logger.should_receive(:error)
Init.new.poll
end
end

0 comments on commit 090225f

Please sign in to comment.