mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
spec display of number of reported work packages
This commit is contained in:
@@ -126,13 +126,17 @@ describe MyController, :type => :controller do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "index" do
|
||||
it "uses the correct scopes for number of reported work packages(just like users_controller)" do
|
||||
WorkPackage.should_receive(:on_active_project).and_return(WorkPackage.where :id => 0)
|
||||
WorkPackage.should_receive(:with_author).and_return(WorkPackage.where :id => 0)
|
||||
WorkPackage.should_receive(:visible).and_return(WorkPackage.where :id => 0)
|
||||
render_views
|
||||
|
||||
before do
|
||||
User.any_instance.should_receive(:reported_work_package_count).and_return(42)
|
||||
get :index
|
||||
end
|
||||
|
||||
it "should show the number of reported packages" do
|
||||
expect(response.body).to include("Reported work packages (42)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -502,16 +502,16 @@ describe UsersController do
|
||||
type_id: work_package.type_id,
|
||||
project_id: work_package.project_id)) }
|
||||
|
||||
before { allow(User).to receive(:current).and_return(user.reload) }
|
||||
before do
|
||||
allow(User).to receive(:current).and_return(user.reload)
|
||||
allow_any_instance_of(User).to receive(:reported_work_package_count).and_return(42)
|
||||
|
||||
it { get :show, id: user.id }
|
||||
end
|
||||
|
||||
it "uses the correct scopes for number of reported work packages(just like my_controller)" do
|
||||
WorkPackage.should_receive(:on_active_project).and_return(WorkPackage.where :id => 0)
|
||||
WorkPackage.should_receive(:with_author).and_return(WorkPackage.where :id => 0)
|
||||
WorkPackage.should_receive(:visible).and_return(WorkPackage.where :id => 0)
|
||||
get :show, id: user.id
|
||||
get :show, id: user.id
|
||||
end
|
||||
|
||||
it "should include the number of reported work packages" do
|
||||
expect(response.body).to include("Reported work packages: 42")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user