Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rails 4.0, 4.1, 4.2 to test matrix #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ gemfile:
- gemfiles/rails30.gemfile
- gemfiles/rails31.gemfile
- gemfiles/rails32.gemfile
- gemfiles/rails40.gemfile
- gemfiles/rails41.gemfile
- gemfiles/rails42.gemfile
rvm:
- 1.8.7
- 1.9.2
Expand All @@ -25,3 +28,21 @@ matrix:
gemfile: gemfiles/rails23.gemfile
- rvm: rbx
gemfile: gemfiles/rails23.gemfile
- rvm: 1.8.7
gemfile: gemfiles/rails40.gemfile
- rvm: 1.8.7
gemfile: gemfiles/rails41.gemfile
- rvm: 1.8.7
gemfile: gemfiles/rails42.gemfile
- rvm: jruby-18mode
gemfile: gemfiles/rails40.gemfile
- rvm: jruby-18mode
gemfile: gemfiles/rails41.gemfile
- rvm: jruby-18mode
gemfile: gemfiles/rails42.gemfile
- rvm: 1.9.2
gemfile: gemfiles/rails40.gemfile
- rvm: 1.9.2
gemfile: gemfiles/rails41.gemfile
- rvm: 1.9.2
gemfile: gemfiles/rails42.gemfile
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group :tools do
gem "guard"
gem "guard-rspec"
gem "guard-bundler"
gem "fuubar"
gem "fuubar", "~> 1.0"
gem "rb-fsevent"
gem "ruby_gntp", :group => :darwin
end
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails31.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
source "http://rubygems.org"

gem "rails", "~> 3.1.8"

gem "i18n", "< 0.7.0"
gemspec :path=>"../"
1 change: 1 addition & 0 deletions gemfiles/rails32.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "http://rubygems.org"

gem "rails", "~> 3.2.8"
gem "i18n", "< 0.7.0"

gemspec :path=>"../"
8 changes: 8 additions & 0 deletions gemfiles/rails40.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 4.0.0"
gem "activerecord", require: 'active_record'
gem "activerecord-session_store"
gemspec :path=>"../"
8 changes: 8 additions & 0 deletions gemfiles/rails41.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 4.1.0"
gem "activerecord", require: 'active_record'
gem "activerecord-session_store"
gemspec :path=>"../"
8 changes: 8 additions & 0 deletions gemfiles/rails42.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 4.2.0"
gem "activerecord", require: 'active_record'
gem "activerecord-session_store"
gemspec :path=>"../"
8 changes: 6 additions & 2 deletions lib/casclient/tickets/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def get_session_for_service_ticket(st)
session_id = read_service_session_lookup(st)
unless session_id.nil?
# This feels a bit hackish, but there isn't really a better way to go about it that I am aware of yet
session = ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session_id})
if ActiveRecord::SessionStore.respond_to?(:session_class)
session = ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session_id})
else
session = ActionDispatch::Session::ActiveRecordStore.session_class.find_by(:session_id => session_id)
end
else
log.warn("Couldn't destroy session service ticket #{st} because no corresponding session id could be found.")
end
Expand Down Expand Up @@ -106,7 +110,7 @@ def store_service_session_lookup(st, controller)

# Returns the local Rails session ID corresponding to the given
# ServiceTicket. This is done by reading the contents of the
# cas_sess.<session ticket> file created in a prior call to
# cas_sess.<session ticket> file created in a prior call to
# #store_service_session_lookup.
def read_service_session_lookup(st)
raise CASException, "No service_ticket specified." if st.nil?
Expand Down
8 changes: 6 additions & 2 deletions lib/casclient/tickets/storage/active_record_ticket_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ module Storage
# Proxy Granting Tickets and their IOUs are stored in the cas_pgtious table.
#
# This ticket store takes the following config parameters
# :pgtious_table_name - the name of the table
# :pgtious_table_name - the name of the table
class ActiveRecordTicketStore < AbstractTicketStore

def initialize(config={})
config ||= {}
if config[:pgtious_table_name]
CasPgtiou.set_table_name = config[:pgtious_table_name]
end
ActiveRecord::SessionStore.session_class = ServiceTicketAwareSession
if ActiveRecord::SessionStore.respond_to?(:session_class=)
ActiveRecord::SessionStore.session_class = ServiceTicketAwareSession
else
ActionDispatch::Session::ActiveRecordStore.session_class = ServiceTicketAwareSession
end
end

def store_service_session_lookup(st, controller)
Expand Down
4 changes: 2 additions & 2 deletions rubycas-client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Gem::Specification.new do |gem|

gem.add_dependency("activesupport")
gem.add_development_dependency("rake")
gem.add_development_dependency("database_cleaner", "~> 0.9.1")
gem.add_development_dependency("database_cleaner", "~> 1.0.0")
gem.add_development_dependency("json")
gem.add_development_dependency("rspec")
gem.add_development_dependency("rspec", "~> 2.14.0")
gem.add_development_dependency("appraisal")
gem.add_development_dependency("rails")
gem.add_development_dependency("simplecov")
Expand Down
6 changes: 5 additions & 1 deletion spec/support/shared_examples_for_ticket_stores.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@
end
context "the session" do
it "should be destroyed" do
ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session.session_id}).should be_nil
if ActiveRecord::SessionStore.respond_to?(:session_class=)
ActiveRecord::SessionStore.session_class.find(:first, :conditions => {:session_id => session.session_id}).should be_nil
else
ActionDispatch::Session::ActiveRecordStore.session_class.find_by(:session_id => session.session_id).should be_nil
end
end
end
it "should destroy session for the given service ticket" do
Expand Down