Better user specs for joining tables

This commit is contained in:
2013-12-09 10:01:06 +01:00
parent afb30556bd
commit 087cfa639d
15 changed files with 159 additions and 16 deletions
@@ -23,6 +23,12 @@ step "I should be signed in as a user through facebook" do
step "the newly created user info should be stored in the local storage"
end
step 'there is another signed in user user' do
Capybara.session_name = :other_user
step 'there is another user'
visit test_login_admin_users_path(email: @other_user.email)
end
step "I should be redirected to the user home" do
page.current_path.should == user_root_path
end
@@ -0,0 +1,29 @@
step "the original user should see a join request message" do
Capybara.session_name = :default
request_text = page.evaluate_script(%|t('join_request.body', {email: '#{@other_user.email}'})|)
request_text.should be_present
page.should have_content request_text
end
step "the original user should not see the join request anymore" do
Capybara.session_name = :default
request_text = page.evaluate_script(%|t('join_request.body', {email: '#{@other_user.email}'})|)
request_text.should be_present
page.should_not have_content request_text
end
step "the original user approves the other user's join request" do
find('.approve-join-request-button').click
end
step "the original user rejects the other user's join request" do
find('.reject-join-request-button').click
end
step "the other user should see a join reject message" do
Capybara.session_name = :other_user
reject_text = I18n.t('messages.join_request_rejected')
reject_text.should be_present
reject_text.should_not include 'translation'
page.should have_content reject_text
end
@@ -15,3 +15,15 @@ step "the user clicks on the user order button" do
find('#active-order-table .btn-primary').click
sleep 1
end
step "the user has an active order" do
step 'there is a section'
step 'there is a table'
step 'the user has an active list'
end
step "there is a signed in user with an active order" do
step "I am signed in as a user"
step "the user has an active order"
end