Sha256: 3d1758145103a4784b4e4593b47558cf498014afa6a2b9ec2bcd78affb609160

Contents?: true

Size: 1.89 KB

Versions: 37

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

describe 'account settings view' do
  before(:each) do
    IuguSDK::enable_social_login = true
    IuguSDK::enable_social_linking = true
    IuguSDK::enable_user_cancel = true
    visit '/account/auth/facebook'
    visit profile_settings_path
  end 

  it { page.should have_content I18n.t("iugu.social_account") }

  context "when enable_user_cancel == true" do
    before(:each) do
      IuguSDK::enable_user_cancel = true
      visit profile_settings_path
    end 
    
    it { page.should have_link I18n.t("iugu.remove_user") }
  end

  context "when enable_user_cancel == false" do
    before(:each) do
      IuguSDK::enable_user_cancel = false
      visit profile_settings_path
    end 
    it { page.should_not have_link I18n.t("iugu.remove_user") }
  end

  context "when user is being destroyed" do
    before(:each) do
      click_on I18n.t("iugu.remove_user")
    end

    it { page.should have_content I18n.t("iugu.user_destruction_in") }
    it { page.should have_link I18n.t("iugu.undo") }
  
  end

  context "when user destruction job is locked" do
    before(:each) do
      User.last.destroy
      @job = User.last.destruction_job
      @job.locked_at = Time.now
      @job.save
      visit profile_settings_path
    end

    it { page.should_not have_link I18n.t("iugu.undo") }
  
  end

  context "when enable_social_linking == false" do
    before(:each) do
      IuguSDK::enable_social_linking = false
      visit profile_settings_path
    end

    it { page.should_not have_content I18n.t("iugu.social_account") }
  
  end

  context "when user is a guest" do
    before(:each) do
      IuguSDK::enable_guest_user = true
      visit root_path
      click_link I18n.t("iugu.sign_out")
      visit new_user_registration_path
      click_link I18n.t("iugu.try_first")
      visit profile_settings_path
    end

    it { page.should have_button I18n.t("iugu.become_user") } 
  
  end

end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.23 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.22 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.21 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.20 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.19 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.18 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.17 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.16 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.14 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.13 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.12 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.11 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.10 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.9 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.7 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.5 spec/requests/user_spec.rb
iugusdk-1.0.0.alpha.4 spec/requests/user_spec.rb