Rails v.4.0を使用していました。機能仕様を使用してビューをテストするために、Factory Girl と Capybara gem を使用します。ここでの問題は、機能仕様にサインイン用の汎用メソッドが必要なことです。したがって、すべての機能仕様でこのメソッドを使用して、コードの繰り返しを避けることができます。私の方法は次のようになります。
    feature 'general' do
        ...
        def sign_in(user)
             visit root_path    
             fill_in 'email', with: user.email
             fill_in 'password', with: user.password
             click_button 'Sign in'
        end
        ...
        scenario 'Create new folder on system' do
             user = FactoryGirl.create(:user)
             sign_in(user)
             ... do more things here with logged in user
        end
        ...
    end
私もこのようなことをしようとしました:
        def sign_in(user)
             visit root_path
             given(:temporaly_user) { User.make(:email=> user.email, :password=> user.password) } 
             fill_in 'email', with: temporaly_user.email
             fill_in 'password', with: temporaly_user.password
             click_button 'Sign in'
        end
指定されたメソッドが定義されていないことを示しています。指定されたメソッドは、他のメソッド内では機能しません。
誰でも私を助けることができますか?