From da8e76edb0fb7ec568406e1902895daa77d94cac Mon Sep 17 00:00:00 2001 From: nilsding Date: Fri, 26 Dec 2014 15:28:53 +0100 Subject: [PATCH] added follow user spec --- spec/features/users/follow_user_spec.rb | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/features/users/follow_user_spec.rb diff --git a/spec/features/users/follow_user_spec.rb b/spec/features/users/follow_user_spec.rb new file mode 100644 index 00000000..3d03347f --- /dev/null +++ b/spec/features/users/follow_user_spec.rb @@ -0,0 +1,28 @@ +include Warden::Test::Helpers +Warden.test_mode! + +feature "User profile page", :devise do + + after :each do + Warden.test_reset! + end + + scenario "user gets followed", js: true do + me = FactoryGirl.create(:user) + other = FactoryGirl.create(:user) + + login_as me, scope: :user + visit show_user_profile_path(other.screen_name) + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_1.png"), full: true + + click_button "Follow" + wait_for_ajax + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true + + expect(page).to have_text("FOLLOWING") + + click_link 'Followers' + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true + expect(page).to have_text(me.screen_name) + end +end