Commit 74c817c7 authored by Semyon Pupkov's avatar Semyon Pupkov

Tiny refactoring example in admin users feature spec

parent 1591c90f
...@@ -243,30 +243,30 @@ describe "Admin::Users", feature: true do ...@@ -243,30 +243,30 @@ describe "Admin::Users", feature: true do
end end
describe "GET /admin/users/:id/projects" do describe "GET /admin/users/:id/projects" do
let(:group) { create(:group) }
let!(:project) { create(:project, group: group) }
before do before do
@group = create(:group) group.add_developer(user)
@project = create(:project, group: @group)
@simple_user = create(:user)
@group.add_developer(@simple_user)
visit projects_admin_user_path(@simple_user) visit projects_admin_user_path(user)
end end
it "lists group projects" do it "lists group projects" do
within(:css, '.append-bottom-default + .panel') do within(:css, '.append-bottom-default + .panel') do
expect(page).to have_content 'Group projects' expect(page).to have_content 'Group projects'
expect(page).to have_link @group.name, admin_group_path(@group) expect(page).to have_link group.name, admin_group_path(group)
end end
end end
it 'allows navigation to the group details' do it 'allows navigation to the group details' do
within(:css, '.append-bottom-default + .panel') do within(:css, '.append-bottom-default + .panel') do
click_link @group.name click_link group.name
end end
within(:css, 'h3.page-title') do within(:css, 'h3.page-title') do
expect(page).to have_content "Group: #{@group.name}" expect(page).to have_content "Group: #{group.name}"
end end
expect(page).to have_content @project.name expect(page).to have_content project.name
end end
it 'shows the group access level' do it 'shows the group access level' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment