Sha256: 7f1ec80ffa6b0b56974f4ed95a3b861dfb05e2f5159a6455a2a125bb087aef4a

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require 'rails_helper'

module Pwb
  RSpec.describe "Admin panel", type: :feature, js: true do
    # pending "need to figure out why test below fails on travis"

    before(:all) do
      @admin_user = User.create!(email: "user@example.org", password: "very-secret", admin: true)
      @prop_for_long_term_rent = FactoryGirl.create(
        :pwb_prop,
        :long_term_rent,
        price_rental_monthly_current_cents: 100_000,
        reference: "ref_pfltr"
      )
    end


    scenario 'sign in works' do
      sign_in_as @admin_user.email, @admin_user.password  
      # Capybara.raise_server_errors = false
      # # above needed to prevent this error:
      # # No route matches [GET] "/assets/icons/ellipsis.png"

      # visit('/admin')
      # # puts current_url
      # # require 'pry'; binding.pry
      # # save_and_open_page
      # fill_in('Email', with: @admin_user.email)
      # fill_in('Password', with: @admin_user.password)
      # click_button('Sign in')

      # expect(page).to have_css(".main-menu", count: 1)
      # expect(last('.card').find('h2')).to have_content('Website')
      expect(page).to have_link(nil, href: '/en/admin/properties/new')
      # below fails in travis CI - perhaps because translations aren't loading??
      # expect(page).to have_link('Add a property')

    end

    # scenario 'settings works' do
    #   sign_in_as @admin_user.email, @admin_user.password  
    #   Capybara.raise_server_errors = false

    #   click_link(nil, href: '/en/admin/website/settings')
    #   # visit('/en/admin/website/settings/general')

    #   byebug
    # end



    after(:all) do
      @prop_for_long_term_rent.destroy
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pwb-0.1.1 spec/features/pwb/admin_spec.rb
pwb-0.1.0 spec/features/pwb/admin_spec.rb
pwb-0.0.2 spec/features/pwb/admin_spec.rb