Sha256: 63366e6ccae48209ff16eee3903a6bedb9e5dda4feca3d1be210a32746f485b0

Contents?: true

Size: 1.73 KB

Versions: 3

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

feature "Postal Address Flag" do
  include SessionSteps

  background do
    @user = create(:user_with_account)
    @home_address = @user.profile_fields.create( label: "Home Address", value: "Pariser Platz 1\n 10117 Berlin",
                                                 type: "ProfileFieldTypes::Address" )
      .becomes(ProfileFieldTypes::Address)
    @study_address = @user.profile_fields.create( label: "Study Address", value: "Pariser Platz 1\n 10117 Berlin",
                                                  type: "ProfileFieldTypes::Address" )
      .becomes(ProfileFieldTypes::Address)
  end
  scenario "Selecting a postal address in the own user profile.", js: true do

    login :admin
    visit user_path @user

    within ".box.section.contact_information" do

      page.should have_no_selector('.postal_address .label.radio', visible: true)
      @user.postal_address_field.should == nil

      click_on I18n.t(:edit)
      first("input[type='radio']").click()
      wait_for_ajax

      visit user_path @user
      page.should have_content "Home Address #{@home_address.value} Postanschrift".gsub("\n", "")
      page.should have_no_content "Study Address #{@study_address.value} Postanschrift".gsub("\n", "")
      @user.reload.postal_address_field.should == @home_address

      click_on I18n.t(:edit)
      find(".postal_address.profile_field_#{@study_address.id} input[type='radio']").click()
      wait_for_ajax

      visit user_path @user
      page.should have_no_content "Home Address #{@home_address.value} Postanschrift".gsub("\n", "")
      page.should have_content "Study Address #{@study_address.value} Postanschrift".gsub("\n", "")
      @user.reload.postal_address_field.should == @study_address

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 spec/features/postal_address_flag_spec.rb
your_platform-1.0.0 spec/features/postal_address_flag_spec.rb
your_platform-0.0.2 spec/features/postal_address_flag_spec.rb