-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fast spec helper and a spec for rb_all_projects_controller
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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") | ||
|