From 60b38e26a1bb5b1c04e5ed2085ba29335f6ac677 Mon Sep 17 00:00:00 2001 From: "Christina L. Cole" Date: Sat, 9 Sep 2017 17:43:47 -0400 Subject: [PATCH] revise position specs to match updated app design --- spec/features/position_features_spec.rb | 21 ++++++++----------- .../positions/position_management_spec.rb | 10 +++++++++ spec/features/users/user_features_spec.rb | 13 ++++++++++++ 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 spec/features/positions/position_management_spec.rb create mode 100644 spec/features/users/user_features_spec.rb diff --git a/spec/features/position_features_spec.rb b/spec/features/position_features_spec.rb index 202d9ac..3af0f0a 100644 --- a/spec/features/position_features_spec.rb +++ b/spec/features/position_features_spec.rb @@ -1,31 +1,27 @@ require 'rails_helper' -RSpec.feature 'Position Management' do - context 'nested resource' do - it 'has an index page nested under a user' do +RSpec.feature 'Users and Positions', type: :feature do + context 'as a logged-in user' do + it 'has an add-position page nested under a user' do user = create(:user) - visit user_positions_path(user.id) + visit new_user_position_path(user.id) expect(page.status_code).to eq(200) end - it 'lists the positions of the logged-in user' end context 'user wants to add positions to their profile' do scenario 'there is a link to add new position(s)' do - visit user_position_path + user = create(:user) + visit user_path(user.id) expect(page).to have_link("Add Crew Positions") end scenario 'there is no link to add position(s) if a user profile already has positions' scenario 'there is a form to add new position(s)' do - visit user_position_path + visit user_path click_link("Add Crew Positions") expect(page).to have(css"form#new_position") end - scenario 'the form should display existing positions in the db' do - position = create(:position) - visit new_user_position_path - expect(page).to have_content(postion.name) - end + scenario 'the form should display existing positions in the db' scenario 'the user should gain new position(s) after the form is submitted' end @@ -36,4 +32,5 @@ scenario 'the form should display positions already listed in the user profile' scenario 'the list of positions for a user should update after the form is submitted' end + end diff --git a/spec/features/positions/position_management_spec.rb b/spec/features/positions/position_management_spec.rb new file mode 100644 index 0000000..e7bc153 --- /dev/null +++ b/spec/features/positions/position_management_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +RSpec.feature 'Positions Management', type: :feature do + context 'create positions' do + scenario 'a new position can be added to the db' + scenario 'an existing position can be updated' + scenario 'an existing position can be removed' + scenario 'existing positions in the database can be listed' + end +end diff --git a/spec/features/users/user_features_spec.rb b/spec/features/users/user_features_spec.rb new file mode 100644 index 0000000..a6efb36 --- /dev/null +++ b/spec/features/users/user_features_spec.rb @@ -0,0 +1,13 @@ +require 'rails_helper' + +RSpec.feature "User Management" type: :feature do + scenario "user can view a list of positions add to their account" do + @user = FactoryGirl.create(:user_with_positions) + + visit user_path(@user) + expect(page).to have_content(@user.skills[0].name) + expect(page).to have_content(@user.skills[1].name) + end + + end +end