Skip to content

Commit 29ce2dd

Browse files
author
Lachlan Sylvester
committed
Add rails 4.0, 4.1, 4.2 to test matrix. Fix issues with changes to query api and session_class config
1 parent 195a4b7 commit 29ce2dd

File tree

11 files changed

+67
-9
lines changed

11 files changed

+67
-9
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ gemfile:
44
- gemfiles/rails30.gemfile
55
- gemfiles/rails31.gemfile
66
- gemfiles/rails32.gemfile
7+
- gemfiles/rails40.gemfile
8+
- gemfiles/rails41.gemfile
9+
- gemfiles/rails42.gemfile
710
rvm:
811
- 1.8.7
912
- 1.9.2
@@ -25,3 +28,21 @@ matrix:
2528
gemfile: gemfiles/rails23.gemfile
2629
- rvm: rbx
2730
gemfile: gemfiles/rails23.gemfile
31+
- rvm: 1.8.7
32+
gemfile: gemfiles/rails40.gemfile
33+
- rvm: 1.8.7
34+
gemfile: gemfiles/rails41.gemfile
35+
- rvm: 1.8.7
36+
gemfile: gemfiles/rails42.gemfile
37+
- rvm: jruby-18mode
38+
gemfile: gemfiles/rails40.gemfile
39+
- rvm: jruby-18mode
40+
gemfile: gemfiles/rails41.gemfile
41+
- rvm: jruby-18mode
42+
gemfile: gemfiles/rails42.gemfile
43+
- rvm: 1.9.2
44+
gemfile: gemfiles/rails40.gemfile
45+
- rvm: 1.9.2
46+
gemfile: gemfiles/rails41.gemfile
47+
- rvm: 1.9.2
48+
gemfile: gemfiles/rails42.gemfile

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ group :tools do
66
gem "guard"
77
gem "guard-rspec"
88
gem "guard-bundler"
9-
gem "fuubar"
9+
gem "fuubar", "~> 1.0"
1010
gem "rb-fsevent"
1111
gem "ruby_gntp", :group => :darwin
1212
end

gemfiles/rails31.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
source "http://rubygems.org"
44

55
gem "rails", "~> 3.1.8"
6-
6+
gem "i18n", "< 0.7.0"
77
gemspec :path=>"../"

gemfiles/rails32.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
source "http://rubygems.org"
44

55
gem "rails", "~> 3.2.8"
6+
gem "i18n", "< 0.7.0"
67

78
gemspec :path=>"../"

gemfiles/rails40.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "rails", "~> 4.0.0"
6+
gem "activerecord", require: 'active_record'
7+
gem "activerecord-session_store"
8+
gemspec :path=>"../"

gemfiles/rails41.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "rails", "~> 4.1.0"
6+
gem "activerecord", require: 'active_record'
7+
gem "activerecord-session_store"
8+
gemspec :path=>"../"

gemfiles/rails42.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "rails", "~> 4.2.0"
6+
gem "activerecord", require: 'active_record'
7+
gem "activerecord-session_store"
8+
gemspec :path=>"../"

lib/casclient/tickets/storage.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def get_session_for_service_ticket(st)
2929
session_id = read_service_session_lookup(st)
3030
unless session_id.nil?
3131
# This feels a bit hackish, but there isn't really a better way to go about it that I am aware of yet
32-
session = ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session_id})
32+
if ActiveRecord::SessionStore.respond_to?(:session_class)
33+
session = ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session_id})
34+
else
35+
session = ActionDispatch::Session::ActiveRecordStore.session_class.find_by(:session_id => session_id)
36+
end
3337
else
3438
log.warn("Couldn't destroy session service ticket #{st} because no corresponding session id could be found.")
3539
end
@@ -106,7 +110,7 @@ def store_service_session_lookup(st, controller)
106110

107111
# Returns the local Rails session ID corresponding to the given
108112
# ServiceTicket. This is done by reading the contents of the
109-
# cas_sess.<session ticket> file created in a prior call to
113+
# cas_sess.<session ticket> file created in a prior call to
110114
# #store_service_session_lookup.
111115
def read_service_session_lookup(st)
112116
raise CASException, "No service_ticket specified." if st.nil?

lib/casclient/tickets/storage/active_record_ticket_store.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ module Storage
99
# Proxy Granting Tickets and their IOUs are stored in the cas_pgtious table.
1010
#
1111
# This ticket store takes the following config parameters
12-
# :pgtious_table_name - the name of the table
12+
# :pgtious_table_name - the name of the table
1313
class ActiveRecordTicketStore < AbstractTicketStore
1414

1515
def initialize(config={})
1616
config ||= {}
1717
if config[:pgtious_table_name]
1818
CasPgtiou.set_table_name = config[:pgtious_table_name]
1919
end
20-
ActiveRecord::SessionStore.session_class = ServiceTicketAwareSession
20+
if ActiveRecord::SessionStore.respond_to?(:session_class=)
21+
ActiveRecord::SessionStore.session_class = ServiceTicketAwareSession
22+
else
23+
ActionDispatch::Session::ActiveRecordStore.session_class = ServiceTicketAwareSession
24+
end
2125
end
2226

2327
def store_service_session_lookup(st, controller)

rubycas-client.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Gem::Specification.new do |gem|
2424

2525
gem.add_dependency("activesupport")
2626
gem.add_development_dependency("rake")
27-
gem.add_development_dependency("database_cleaner", "~> 0.9.1")
27+
gem.add_development_dependency("database_cleaner", "~> 1.0.0")
2828
gem.add_development_dependency("json")
29-
gem.add_development_dependency("rspec")
29+
gem.add_development_dependency("rspec", "~> 2.0")
3030
gem.add_development_dependency("appraisal")
3131
gem.add_development_dependency("rails")
3232
gem.add_development_dependency("simplecov")

0 commit comments

Comments
 (0)