Skip to content

Commit

Permalink
Add fast spec helper and a spec for rb_all_projects_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanuan committed Jul 28, 2012
1 parent c2b121d commit bac46c8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
47 changes: 47 additions & 0 deletions spec/controllers/rb_all_projects_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'fast_spec_helper'

class ScrumStatistics
def initialize(score)
@score = score
end
def score
@score
end
end
class Project
STATUS_ACTIVE = 1
def initialize(score)
@stats = ScrumStatistics.new(score)
end
def scrum_statistics
@stats
end
end
module RbCommonHelper
end
class ApplicationController
def self.before_filter(*args)
end
end
class Object
def unloadable
end
end

require 'rb_all_projects_controller'

describe RbAllProjectsController, "#statistics" do
it "returns enabled active projects sorted by the scrum statistics score" do
# Set up
project1 = Project.new(1)
project2 = Project.new(2)
project3 = Project.new(3)
unsorted_projects = [ project3, project1, project2 ]

# Exercise && Verify
RbCommonHelper.should_receive(:find_backlogs_enabled_active_projects).and_return(unsorted_projects)
sorted_projects = [ project1, project2, project3 ]
RbAllProjectsController.new.statistics.should eq(sorted_projects)

end
end
8 changes: 8 additions & 0 deletions spec/fast_spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'config'

plugin_path = 'plugins/redmine_backlogs'
$:.push File.expand_path("#{plugin_path}/app/helpers")
$:.push File.expand_path("#{plugin_path}/app/models")
$:.push File.expand_path("#{plugin_path}/app/controllers")
$:.push File.expand_path("#{plugin_path}/lib")

0 comments on commit bac46c8

Please sign in to comment.