enju_seed 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 362ace361f13785ccf77dc2873132c048c05e227
4
- data.tar.gz: e9727ab88f7dae8c91907d9940f8f6c424238aac
2
+ SHA256:
3
+ metadata.gz: 0b9840693279f858c771db87616a36faac54f576468c54fbe7f90ee3353b323d
4
+ data.tar.gz: 3bfbfdbaf6b9f76e53692c8e4bdf297d6a7926bfcf61efc6a0b980b062ccf69f
5
5
  SHA512:
6
- metadata.gz: '024491834eb40aaf12678e40394ab3757d619188fba9d4e2aa9c754bcd515ea558bba73e84a2cdd26f562914317b1bad7a50a479b161b41da1505511f9f8c659'
7
- data.tar.gz: f919365e4df4f48ddf4fb2005598fe8121c773be7772fcc0f6fc5e31f0c23b2c88dc3bba272f9643c02bdaa26b3314d7563e7970deb0815b6a8bec7b97d313f1
6
+ metadata.gz: b83d9d6441b55998b8553c6fa56c3433f657c5105cb82ed3cfbae77abc8a83f61c2057b6df71b56e50501cd4ba520579c911dd3a7e039e0af6fadd1b85aed03b
7
+ data.tar.gz: e3c548f4bc03ba8ec07507be460c1d97c60f1c4c537e71f62b538ead89f3ffbf92e2403a58b3a46807c7c42eec978e76cc7b8be429e82b11267dfde55bb62346
@@ -1,4 +1,5 @@
1
1
  class ProfilesController < ApplicationController
2
+ before_action :authenticate_user!
2
3
  before_action :set_profile, only: [:show, :edit, :update, :destroy]
3
4
  before_action :check_policy, only: [:index, :new, :create]
4
5
  before_action :prepare_options, only: [:new, :edit]
@@ -1,6 +1,4 @@
1
1
  class Profile < ActiveRecord::Base
2
- enju_search_log_profile_model if defined?(EnjuSearchLog)
3
-
4
2
  scope :administrators, -> { joins(user: :role).where('roles.name = ?', 'Administrator') }
5
3
  scope :librarians, -> { joins(user: :role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
6
4
  belongs_to :user, dependent: :destroy, optional: true
@@ -1,3 +1,3 @@
1
1
  module EnjuSeed
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -121,7 +121,7 @@ describe ProfilesController do
121
121
  describe "When not logged in" do
122
122
  it "assigns the requested user as @profile" do
123
123
  get :show, params: { id: profiles(:admin).id }
124
- assigns(:profile).should eq(profiles(:admin))
124
+ assigns(:profile).should eq nil
125
125
  response.should redirect_to(new_user_session_url)
126
126
  end
127
127
  end
@@ -225,7 +225,7 @@ describe ProfilesController do
225
225
  it "should not assign the requested user as @profile" do
226
226
  profile = FactoryBot.create(:profile)
227
227
  get :edit, params: { id: profile.id }
228
- assigns(:profile).should eq(profile)
228
+ assigns(:profile).should eq nil
229
229
  response.should redirect_to(new_user_session_url)
230
230
  end
231
231
  end
@@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base
2
2
  # Prevent CSRF attacks by raising an exception.
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
- before_action :set_paper_trail_whodunnit
6
5
  after_action :verify_authorized
7
6
 
8
7
  include EnjuLibrary::Controller
@@ -67,6 +67,12 @@ RSpec.configure do |config|
67
67
  Sunspot.session = SunspotMatchers::SunspotSessionSpy.new(Sunspot.session)
68
68
  end
69
69
  config.include SunspotMatchers
70
+
71
+ config.before(:each) do |example|
72
+ if example.metadata[:type] == :system
73
+ driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
74
+ end
75
+ end
70
76
  end
71
77
 
72
78
  FactoryBot.definition_file_paths << "#{::Rails.root}/../../spec/factories"
@@ -0,0 +1,39 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'Profiles', type: :system do
4
+ include Devise::Test::IntegrationHelpers
5
+ fixtures :all
6
+
7
+ describe 'When logged in as Administrator' do
8
+ before do
9
+ sign_in users(:admin)
10
+ end
11
+
12
+ it 'should show user_number' do
13
+ visit profile_path(profiles(:admin))
14
+ expect(page).to have_content '00001'
15
+ end
16
+ end
17
+
18
+ describe 'When logged in as Librarian' do
19
+ before do
20
+ sign_in users(:librarian1)
21
+ end
22
+
23
+ it 'should show user_number' do
24
+ visit profile_path(profiles(:admin))
25
+ expect(page).not_to have_content '00001'
26
+ end
27
+ end
28
+
29
+ describe 'When logged in as User' do
30
+ before do
31
+ sign_in users(:user1)
32
+ end
33
+
34
+ it 'should show user_number' do
35
+ visit profile_path(profiles(:admin))
36
+ expect(page).not_to have_content '00001'
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_seed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2019-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.5'
47
+ version: '4.6'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.5'
54
+ version: '4.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pundit
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.8'
89
+ version: '1.9'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.8'
96
+ version: '1.9'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: kaminari
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -388,6 +388,34 @@ dependencies:
388
388
  - - ">="
389
389
  - !ruby/object:Gem::Version
390
390
  version: '0'
391
+ - !ruby/object:Gem::Dependency
392
+ name: selenium-webdriver
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - ">="
396
+ - !ruby/object:Gem::Version
397
+ version: '0'
398
+ type: :development
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - ">="
403
+ - !ruby/object:Gem::Version
404
+ version: '0'
405
+ - !ruby/object:Gem::Dependency
406
+ name: puma
407
+ requirement: !ruby/object:Gem::Requirement
408
+ requirements:
409
+ - - ">="
410
+ - !ruby/object:Gem::Version
411
+ version: '0'
412
+ type: :development
413
+ prerelease: false
414
+ version_requirements: !ruby/object:Gem::Requirement
415
+ requirements:
416
+ - - ">="
417
+ - !ruby/object:Gem::Version
418
+ version: '0'
391
419
  description: Seed module for Next-L Enju
392
420
  email:
393
421
  - nabeta@fastmail.fm
@@ -715,6 +743,7 @@ files:
715
743
  - spec/spec_helper.rb
716
744
  - spec/support/controller_macros.rb
717
745
  - spec/support/devise.rb
746
+ - spec/system/profiles_spec.rb
718
747
  - spec/views/my_accounts/show.html.erb_spec.rb
719
748
  - spec/views/profiles/edit.html.erb_spec.rb
720
749
  - spec/views/profiles/index.html.erb_spec.rb
@@ -738,8 +767,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
738
767
  - !ruby/object:Gem::Version
739
768
  version: '0'
740
769
  requirements: []
741
- rubyforge_project:
742
- rubygems_version: 2.6.14.3
770
+ rubygems_version: 3.0.3
743
771
  signing_key:
744
772
  specification_version: 4
745
773
  summary: enju_seed plugin
@@ -989,6 +1017,7 @@ test_files:
989
1017
  - spec/models/user_spec.rb
990
1018
  - spec/models/role_spec.rb
991
1019
  - spec/requests/profiles_spec.rb
1020
+ - spec/system/profiles_spec.rb
992
1021
  - spec/support/controller_macros.rb
993
1022
  - spec/support/devise.rb
994
1023
  - spec/factories/profile.rb