How to create more than one connection via Rspec ?

25 views
Skip to first unread message

Николай Спелый

unread,
Sep 18, 2015, 7:35:52 AM9/18/15
to Ruby on Rails: Talk
Hi.
Now i writing tests via Rspec and appeared a question.

Question is how can i create few connections, at least two connections for testing online changes at page ? It's only online chat.

At this time a have only 

let(:user) { FactoryGirl.create(:user) }

before do
 visit signin_path
 fill_in "Name",    with: user.name
 fill_in "Password", with: user.password
 click_button "Sign in"
end

But i looking for something like this:
        
let(:first_user) { FactoryGirl.create(:user) }
        let(:second_user) { FactoryGirl.create(:user) }

        at connection: :first_connection do 
     before do
    visit signin_path
    fill_in "Name",    with: first_user.name
    fill_in "Password", with: first_user.password
    click_button "Sign in"
  end
       end


       at connection: :second_connection do
     before do
    visit signin_path
    fill_in "Name",    with: second_user.name
    fill_in "Password", with: second_user.password
    click_button "Sign in"
  end
      end
   
      # manipulate with connections

Thanks.
     


Николай Спелый

unread,
Sep 18, 2015, 11:44:12 AM9/18/15
to Ruby on Rails: Talk
Reply all
Reply to author
Forward
0 new messages