require 'rails_helper'



feature "First login as User" do
  background do
    @current_user = FactoryGirl.create(:user)
    login_as @current_user
  end

  scenario "Display all chairs" do
    chairs.each do |chair|
      expect(page).to have_content(chair.name)
    end
  end

  scenario "Change button layout after applying" do
    Click "Berwerben"
    expect(page).to have_content("Gestellt")
  end

end
require 'rails_helper'



feature "First login as User" do
  background do
    @current_user = FactoryGirl.create(:user)
    login_as @current_user
  end

  scenario "Display all chairs" do
    chairs.each do |chair|
      expect(page).to have_content(chair.name)
    end
  end

  scenario "Change button layout after applying" do
    Click "Bewerben"
    expect(page).to have_content("Gestellt")
  end

  scenario "Unique chair applications" do
    if have_content("Gestellt")
      Click "Bewerben"
       expect(page).to have_content("Gestellt", count: 1)
    end
  end

end
Add uniqueness constraint test for applying to a chair
Add uniqueness constraint test for applying to a chair
