challah 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Challah 0.3.4
2
+
3
+ * Added `challah/test` include to allow for testing in your app.
4
+
1
5
  ## Challah 0.3.3
2
6
 
3
7
  * Added User#valid_session? method to check to see if this user is valid on each page load.
@@ -0,0 +1,26 @@
1
+ # Used to persist session data in test mode instead of using cookies. Stores the session
2
+ # data lazily in a global var, accessible across the testing environment.
3
+ class TestSessionStore
4
+ def initialize(session = nil)
5
+ @session = session
6
+ end
7
+
8
+ def destroy
9
+ $challah_test_session = nil
10
+ end
11
+
12
+ def read
13
+ if $challah_test_session
14
+ return $challah_test_session.to_s.split(':')
15
+ end
16
+
17
+ nil
18
+ end
19
+
20
+ def save(token, user_id)
21
+ $challah_test_session = "#{token}:#{user_id}"
22
+ true
23
+ end
24
+ end
25
+
26
+ Challah.options[:storage_class] = TestSessionStore
@@ -1,3 +1,3 @@
1
1
  module Challah
2
- VERSION = "0.3.3" unless defined?(::Challah::VERSION)
2
+ VERSION = "0.3.4" unless defined?(::Challah::VERSION)
3
3
  end
data/test/helper.rb CHANGED
@@ -22,6 +22,7 @@ require 'rails/test_help'
22
22
 
23
23
  # Load the challah libraries
24
24
  require 'challah'
25
+ require 'challah/test'
25
26
 
26
27
  # Setup the challah app, including running migrations within the rails app
27
28
  # TODO - this causes some annoying output in 1.9.3, still works, but would like to suppress
@@ -37,31 +38,6 @@ class ActiveSupport::TestCase
37
38
  self.use_transactional_fixtures = true
38
39
  end
39
40
 
40
- # Used to persist session data in test mode instead of using cookies. Stores the session
41
- # data lazily in a global var, accessible across the testing environment.
42
- class TestSessionStore
43
- def initialize(session = nil)
44
- @session = session
45
- end
46
-
47
- def destroy
48
- $challah_test_session = nil
49
- end
50
-
51
- def read
52
- if $challah_test_session
53
- return $challah_test_session.to_s.split(':')
54
- end
55
-
56
- nil
57
- end
58
-
59
- def save(token, user_id)
60
- $challah_test_session = "#{token}:#{user_id}"
61
- true
62
- end
63
- end
64
-
65
41
  class MockController
66
42
  include Challah::Controller
67
43
 
@@ -117,8 +93,6 @@ class MockRequest
117
93
  end
118
94
  end
119
95
 
120
- Challah.options[:storage_class] = TestSessionStore
121
-
122
96
  # Monkey patch fix for shoulda and Rails 3.1+.
123
97
  module Shoulda
124
98
  module ActiveRecord
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: challah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70290451108860 !ruby/object:Gem::Requirement
16
+ requirement: &70136788275180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70290451108860
24
+ version_requirements: *70136788275180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70290451108360 !ruby/object:Gem::Requirement
27
+ requirement: &70136788274680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70290451108360
35
+ version_requirements: *70136788274680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bcrypt-ruby
38
- requirement: &70290451107900 !ruby/object:Gem::Requirement
38
+ requirement: &70136788274220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70290451107900
46
+ version_requirements: *70136788274220
47
47
  description: A simple ruby gem for authentication, users, roles and permissions.
48
48
  email:
49
49
  - john@johntornow.com
@@ -97,6 +97,7 @@ files:
97
97
  - lib/challah/techniques/api_key_technique.rb
98
98
  - lib/challah/techniques/password_technique.rb
99
99
  - lib/challah/techniques.rb
100
+ - lib/challah/test.rb
100
101
  - lib/challah/version.rb
101
102
  - lib/challah.rb
102
103
  - lib/tasks/crud.rake