casino_core 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -11,6 +11,8 @@ doc
11
11
 
12
12
  # bundler
13
13
  .bundle
14
+ vendor
15
+ Gemfile.lock
14
16
 
15
17
  # jeweler generated
16
18
  pkg
@@ -1 +1 @@
1
- ruby-1.9.3-p194
1
+ 1.9.3-p194
@@ -13,6 +13,7 @@ development:
13
13
 
14
14
  test:
15
15
  adapter: sqlite3
16
- database: db/test.sqlite3
16
+ database: ':memory:'
17
17
  pool: 5
18
18
  timeout: 5000
19
+ verbosity: quiet
@@ -1,4 +1,5 @@
1
1
  require 'active_support/inflector'
2
+ require 'active_record'
2
3
 
3
4
  module CASinoCore
4
5
  autoload :Authenticator, 'casino_core/authenticator.rb'
@@ -14,9 +15,8 @@ module CASinoCore
14
15
  def setup(environment = nil, options = {})
15
16
  @environment = environment || 'development'
16
17
  root_path = options[:application_root] || '.'
17
- require 'active_record'
18
- require 'yaml'
19
- ActiveRecord::Base.establish_connection YAML.load_file(File.join(root_path, 'config/database.yml'))[@environment]
18
+
19
+ establish_connection(@environment, root_path) unless active_record_connected?
20
20
 
21
21
  config = YAML.load_file(File.join(root_path, 'config/cas.yml'))[@environment].symbolize_keys
22
22
  recursive_symbolize_keys!(config)
@@ -31,6 +31,19 @@ module CASinoCore
31
31
  hash.values.select{|v| v.is_a? Hash}.each{|h| recursive_symbolize_keys!(h)}
32
32
  hash.values.select{|v| v.is_a? Array}.each{|a| a.select{|v| v.is_a? Hash}.each{|h| recursive_symbolize_keys!(h)}}
33
33
  end
34
+
35
+ def active_record_connected?
36
+ ActiveRecord::Base.connection
37
+ rescue ActiveRecord::ConnectionNotEstablished
38
+ false
39
+ end
40
+
41
+ def establish_connection(env, root_path)
42
+ require 'yaml'
43
+
44
+ db_cfg = YAML::load(ERB.new(IO.read(File.join(root_path, 'config/database.yml'))).result)[env]
45
+ ActiveRecord::Base.establish_connection db_cfg
46
+ end
34
47
  end
35
48
  end
36
49
 
@@ -1,3 +1,4 @@
1
+ require 'erb'
1
2
  require 'yaml'
2
3
  require 'logger'
3
4
  require 'active_record'
@@ -16,17 +17,12 @@ namespace :casino_core do
16
17
  end
17
18
 
18
19
  task :configuration => :environment do
19
- @config = YAML.load_file('config/database.yml')[DATABASE_ENV]
20
20
  CASinoCore.setup DATABASE_ENV
21
- end
22
-
23
- task :configure_connection => :configuration do
24
- ActiveRecord::Base.establish_connection @config
25
- ActiveRecord::Base.logger = Logger.new STDOUT if @config['logger']
21
+ ActiveRecord::Base.logger = CASinoCore::Settings.logger
26
22
  end
27
23
 
28
24
  desc 'Migrate the database (options: VERSION=x, VERBOSE=false)'
29
- task :migrate => :configure_connection do
25
+ task :migrate => :configuration do
30
26
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
31
27
  ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
32
28
  ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
@@ -34,14 +30,14 @@ namespace :casino_core do
34
30
  end
35
31
 
36
32
  desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).'
37
- task :rollback => :configure_connection do
33
+ task :rollback => :configuration do
38
34
  step = ENV['STEP'] ? ENV['STEP'].to_i : 1
39
35
  ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_paths, step)
40
36
  end
41
37
 
42
38
  namespace :schema do
43
39
  desc 'Create a db/schema.rb file that can be portably used against any DB supported by AR'
44
- task :dump => :configure_connection do
40
+ task :dump => :configuration do
45
41
  require 'active_record/schema_dumper'
46
42
  File.open(SCHEMA_PATH, "w:utf-8") do |file|
47
43
  ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
@@ -49,7 +45,7 @@ namespace :casino_core do
49
45
  end
50
46
 
51
47
  desc 'Load a schema.rb file into the database'
52
- task :load => :configure_connection do
48
+ task :load => :configuration do
53
49
  if File.exists?(SCHEMA_PATH)
54
50
  load(SCHEMA_PATH)
55
51
  else
@@ -1,3 +1,3 @@
1
1
  module CASinoCore
2
- VERSION = '1.4.3'
2
+ VERSION = '1.4.4'
3
3
  end
@@ -114,4 +114,11 @@ describe CASinoCore::Model::ServiceTicket do
114
114
  end
115
115
  end
116
116
  end
117
+
118
+ describe '#service_with_ticket_url' do
119
+ it 'does not escape the url from the database' do
120
+ unconsumed_ticket.service = 'https://host.example.org/test.php?t=other&other=testing'
121
+ unconsumed_ticket.service_with_ticket_url.should eq('https://host.example.org/test.php?t=other&other=testing&ticket=ST-12345')
122
+ end
123
+ end
117
124
  end
@@ -1,3 +1,5 @@
1
+ ENV['RAILS_ENV'] ||= ENV['DATABASE_ENV'] || 'test'
2
+
1
3
  require 'active_support/core_ext'
2
4
  require 'simplecov'
3
5
  require 'coveralls'
@@ -31,29 +33,3 @@ require 'casino_core'
31
33
  # Requires supporting ruby files with custom matchers and macros, etc,
32
34
  # in spec/support/ and its subdirectories.
33
35
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
34
-
35
- RSpec.configure do |config|
36
- config.treat_symbols_as_metadata_keys_with_true_values = true
37
-
38
- # Run specs in random order to surface order dependencies. If you find an
39
- # order dependency and want to debug it, you can fix the order by providing
40
- # the seed, which is printed after each run.
41
- # --seed 1234
42
- config.order = 'random'
43
-
44
-
45
- config.before(:suite) do
46
- DatabaseCleaner.strategy = :transaction
47
- end
48
-
49
- config.before(:each) do
50
- CASinoCore.setup 'test'
51
- CASinoCore::Settings.logger.level = ::Logger::Severity::UNKNOWN
52
- DatabaseCleaner.clean_with(:truncation)
53
- DatabaseCleaner.start
54
- end
55
-
56
- config.after(:each) do
57
- DatabaseCleaner.clean
58
- end
59
- end
@@ -0,0 +1,6 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ CASinoCore.setup ENV['RAILS_ENV']
4
+ CASinoCore::Settings.logger.level = ::Logger::Severity::UNKNOWN
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.strategy = :transaction
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.clean_with(:truncation)
8
+ DatabaseCleaner.start
9
+ end
10
+
11
+ config.after(:each) do
12
+ DatabaseCleaner.clean
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ RSpec.configure do |config|
2
+ config.treat_symbols_as_metadata_keys_with_true_values = true
3
+ config.run_all_when_everything_filtered = true
4
+ config.filter_run focus: true
5
+ config.order = 'random'
6
+ end
@@ -0,0 +1,5 @@
1
+ root_path = File.join(File.dirname(__FILE__),'..','..')
2
+ schema_path = File.join(root_path, 'db')
3
+
4
+ CASinoCore.send(:establish_connection, ENV['RAILS_ENV'], root_path)
5
+ load File.join(schema_path, 'schema.rb')
metadata CHANGED
@@ -1,42 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casino_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nils Caspar
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURLakNDQWhLZ0F3SUJB
14
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE3TVEwd0N3WURWUVFEREFScGJt
15
- WnYKTVJVd0V3WUtDWkltaVpQeUxHUUJHUllGY21KallYTXhFekFSQmdvSmtp
16
- YUprL0lzWkFFWkZnTmpiMjB3SGhjTgpNVE13TWpBeU1qSXlOakkyV2hjTk1U
17
- UXdNakF5TWpJeU5qSTJXakE3TVEwd0N3WURWUVFEREFScGJtWnZNUlV3CkV3
18
- WUtDWkltaVpQeUxHUUJHUllGY21KallYTXhFekFSQmdvSmtp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pK0xqbnorVWFPUmsxZHhabGNYWUdjMzR3Rmcx
36
- b1VSdnUwRzgvWXlIVUFtSVUvV0tyanIxYmdjZjFWUnYKUjRLRDFNblVWL3Y1
37
- MDJwaU1sWG1qeE9XZGJLOHl2UUVIa3N1L3pqYkNqU3UrTTJrd0ZtV0dzeDVu
38
- eCtWZHc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2013-04-21 00:00:00.000000000 Z
11
+ cert_chain: []
12
+ date: 2013-07-15 00:00:00.000000000 Z
40
13
  dependencies:
41
14
  - !ruby/object:Gem::Dependency
42
15
  name: rake
@@ -309,7 +282,6 @@ files:
309
282
  - .ruby-version
310
283
  - .travis.yml
311
284
  - Gemfile
312
- - Gemfile.lock
313
285
  - LICENSE.txt
314
286
  - README.md
315
287
  - Rakefile
@@ -427,6 +399,8 @@ files:
427
399
  - spec/processor/two_factor_authenticator_registrator_spec.rb
428
400
  - spec/settings_spec.rb
429
401
  - spec/spec_helper.rb
402
+ - spec/support/casino_core.rb
403
+ - spec/support/database_cleaner.rb
430
404
  - spec/support/factories/login_ticket_factory.rb
431
405
  - spec/support/factories/proxy_granting_ticket_factory.rb
432
406
  - spec/support/factories/proxy_ticket_factory.rb
@@ -435,6 +409,8 @@ files:
435
409
  - spec/support/factories/ticket_granting_ticket_factory.rb
436
410
  - spec/support/factories/two_factor_authenticator_factory.rb
437
411
  - spec/support/factories/user_factory.rb
412
+ - spec/support/rspec.rb
413
+ - spec/support/sqlite3.rb
438
414
  homepage: http://rbcas.org/
439
415
  licenses:
440
416
  - MIT
@@ -448,21 +424,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
448
424
  - - ! '>='
449
425
  - !ruby/object:Gem::Version
450
426
  version: '0'
451
- segments:
452
- - 0
453
- hash: 3956376216012117413
454
427
  required_rubygems_version: !ruby/object:Gem::Requirement
455
428
  none: false
456
429
  requirements:
457
430
  - - ! '>='
458
431
  - !ruby/object:Gem::Version
459
432
  version: '0'
460
- segments:
461
- - 0
462
- hash: 3956376216012117413
463
433
  requirements: []
464
434
  rubyforge_project:
465
- rubygems_version: 1.8.25
435
+ rubygems_version: 1.8.23
466
436
  signing_key:
467
437
  specification_version: 3
468
438
  summary: A CAS server core library.
@@ -496,6 +466,8 @@ test_files:
496
466
  - spec/processor/two_factor_authenticator_registrator_spec.rb
497
467
  - spec/settings_spec.rb
498
468
  - spec/spec_helper.rb
469
+ - spec/support/casino_core.rb
470
+ - spec/support/database_cleaner.rb
499
471
  - spec/support/factories/login_ticket_factory.rb
500
472
  - spec/support/factories/proxy_granting_ticket_factory.rb
501
473
  - spec/support/factories/proxy_ticket_factory.rb
@@ -504,4 +476,6 @@ test_files:
504
476
  - spec/support/factories/ticket_granting_ticket_factory.rb
505
477
  - spec/support/factories/two_factor_authenticator_factory.rb
506
478
  - spec/support/factories/user_factory.rb
479
+ - spec/support/rspec.rb
480
+ - spec/support/sqlite3.rb
507
481
  has_rdoc:
data.tar.gz.sig DELETED
Binary file
@@ -1,88 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- casino_core (1.4.3)
5
- activerecord (~> 3.2.9)
6
- addressable (~> 2.3)
7
- faraday (~> 0.8)
8
- rotp (~> 1.4)
9
- terminal-table (~> 1.4)
10
- useragent (~> 0.4)
11
-
12
- GEM
13
- remote: https://rubygems.org/
14
- specs:
15
- activemodel (3.2.12)
16
- activesupport (= 3.2.12)
17
- builder (~> 3.0.0)
18
- activerecord (3.2.12)
19
- activemodel (= 3.2.12)
20
- activesupport (= 3.2.12)
21
- arel (~> 3.0.2)
22
- tzinfo (~> 0.3.29)
23
- activesupport (3.2.12)
24
- i18n (~> 0.6)
25
- multi_json (~> 1.0)
26
- addressable (2.3.2)
27
- arel (3.0.2)
28
- builder (3.0.4)
29
- colorize (0.5.8)
30
- coveralls (0.6.2)
31
- colorize
32
- multi_json (~> 1.3)
33
- rest-client
34
- simplecov (>= 0.7)
35
- thor
36
- crack (0.3.2)
37
- database_cleaner (0.9.1)
38
- diff-lcs (1.1.3)
39
- factory_girl (4.2.0)
40
- activesupport (>= 3.0.0)
41
- faraday (0.8.5)
42
- multipart-post (~> 1.1)
43
- i18n (0.6.1)
44
- mime-types (1.21)
45
- multi_json (1.6.1)
46
- multipart-post (1.1.5)
47
- nokogiri (1.5.6)
48
- rake (10.0.3)
49
- rest-client (1.6.7)
50
- mime-types (>= 1.16)
51
- rotp (1.4.1)
52
- rspec (2.12.0)
53
- rspec-core (~> 2.12.0)
54
- rspec-expectations (~> 2.12.0)
55
- rspec-mocks (~> 2.12.0)
56
- rspec-core (2.12.2)
57
- rspec-expectations (2.12.1)
58
- diff-lcs (~> 1.1.3)
59
- rspec-mocks (2.12.2)
60
- simplecov (0.7.1)
61
- multi_json (~> 1.0)
62
- simplecov-html (~> 0.7.1)
63
- simplecov-html (0.7.1)
64
- sqlite3 (1.3.7)
65
- terminal-table (1.4.5)
66
- thor (0.17.0)
67
- tzinfo (0.3.35)
68
- useragent (0.4.16)
69
- webmock (1.9.0)
70
- addressable (>= 2.2.7)
71
- crack (>= 0.1.7)
72
- yard (0.8.4.1)
73
-
74
- PLATFORMS
75
- ruby
76
-
77
- DEPENDENCIES
78
- casino_core!
79
- coveralls
80
- database_cleaner (~> 0.9)
81
- factory_girl (~> 4.1)
82
- nokogiri (~> 1.5)
83
- rake (~> 10.0)
84
- rspec (~> 2.12)
85
- simplecov (~> 0.7)
86
- sqlite3 (~> 1.3)
87
- webmock (~> 1.9)
88
- yard (~> 0.8)
metadata.gz.sig DELETED
Binary file