diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 37 | ||||
-rw-r--r-- | spec/routing/group_routing_spec.rb | 4 |
2 files changed, 35 insertions, 6 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 21e5122c06b..b2e6df6060a 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -32,21 +32,46 @@ describe GroupsController do end end + shared_examples 'details view' do + it { is_expected.to render_template('groups/show') } + + context 'as atom' do + let!(:event) { create(:event, project: project) } + let(:format) { :atom } + + it { is_expected.to render_template('groups/show') } + + it 'assigns events for all the projects in the group' do + subject + expect(assigns(:events)).to contain_exactly(event) + end + end + end + describe 'GET #show' do before do sign_in(user) project end - context 'as atom' do - it 'assigns events for all the projects in the group' do - create(:event, project: project) + let(:format) { :html } - get :show, params: { id: group.to_param }, format: :atom + subject { get :show, params: { id: group.to_param }, format: format } - expect(assigns(:events)).not_to be_empty - end + it_behaves_like 'details view' + end + + describe 'GET #details' do + before do + sign_in(user) + project end + + let(:format) { :html } + + subject { get :details, params: { id: group.to_param }, format: format } + + it_behaves_like 'details view' end describe 'GET edit' do diff --git a/spec/routing/group_routing_spec.rb b/spec/routing/group_routing_spec.rb index 71788028cbf..53271550e8b 100644 --- a/spec/routing/group_routing_spec.rb +++ b/spec/routing/group_routing_spec.rb @@ -17,6 +17,10 @@ describe "Groups", "routing" do expect(get("/#{group_path}")).to route_to('groups#show', id: group_path) end + it "to #details" do + expect(get("/groups/#{group_path}/-/details")).to route_to('groups#details', id: group_path) + end + it "to #activity" do expect(get("/groups/#{group_path}/-/activity")).to route_to('groups#activity', id: group_path) end |