current_me 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/current_me.gemspec +20 -0
- data/lib/current_me.rb +39 -0
- data/lib/current_me/railtie.rb +9 -0
- data/lib/current_me/version.rb +3 -0
- data/spec/dummy/.gitignore +15 -0
- data/spec/dummy/.rspec +1 -0
- data/spec/dummy/Gemfile +42 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/rooms_controller.rb +8 -0
- data/spec/dummy/app/controllers/sessions_controller.rb +19 -0
- data/spec/dummy/app/controllers/users_controller.rb +19 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/rooms/index.html.erb +1 -0
- data/spec/dummy/app/views/sessions/new.html.erb +11 -0
- data/spec/dummy/app/views/users/new.html.erb +6 -0
- data/spec/dummy/app/views/users/show.html.erb +5 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/db/migrate/20120717091510_create_users.rb +9 -0
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +241 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/controllers/rooms_controller_spec.rb +27 -0
- data/spec/dummy/spec/controllers/sessions_controller_spec.rb +21 -0
- data/spec/dummy/spec/controllers/users_controller_spec.rb +16 -0
- data/spec/dummy/spec/spec_helper.rb +32 -0
- data/spec/dummy/test/fixtures/.gitkeep +0 -0
- data/spec/dummy/test/functional/.gitkeep +0 -0
- data/spec/dummy/test/integration/.gitkeep +0 -0
- data/spec/dummy/test/performance/browsing_test.rb +12 -0
- data/spec/dummy/test/test_helper.rb +13 -0
- data/spec/dummy/test/unit/.gitkeep +0 -0
- data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy/vendor/plugins/.gitkeep +0 -0
- metadata +212 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe SessionsController do
|
5
|
+
let!(:user) { User.create!(name: 'akiinyo') }
|
6
|
+
|
7
|
+
describe 'destroy' do
|
8
|
+
before {
|
9
|
+
controller.me = user
|
10
|
+
delete :destroy, {id: user.id}
|
11
|
+
}
|
12
|
+
|
13
|
+
specify 'meがいなくなること' do
|
14
|
+
controller.me?.should be_false
|
15
|
+
end
|
16
|
+
|
17
|
+
specify 'トップページへリダイレクトされること' do
|
18
|
+
response.should redirect_to(root_url)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe UsersController do
|
5
|
+
let(:user) { User.create!(name: 'akiinyo') }
|
6
|
+
|
7
|
+
describe 'me' do
|
8
|
+
before {
|
9
|
+
post :create, user: {id: user.id, name: user.name}
|
10
|
+
}
|
11
|
+
|
12
|
+
specify 'meが正しく設定されていること' do
|
13
|
+
controller.me.name.should == 'akiinyo'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# ## Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
|
28
|
+
# If true, the base class of anonymous controllers will be inferred
|
29
|
+
# automatically. This will be the default behavior in future versions of
|
30
|
+
# rspec-rails.
|
31
|
+
config.infer_base_class_for_anonymous_controllers = false
|
32
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/performance_test_help'
|
3
|
+
|
4
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
5
|
+
# Refer to the documentation for all available options
|
6
|
+
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
|
7
|
+
# :output => 'tmp/performance', :formats => [:flat] }
|
8
|
+
|
9
|
+
def test_homepage
|
10
|
+
get '/'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: current_me
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tagaki Aki
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.0.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.0.0
|
46
|
+
description: possess a current user
|
47
|
+
email:
|
48
|
+
- aki.hosecarioka@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- current_me.gemspec
|
59
|
+
- lib/current_me.rb
|
60
|
+
- lib/current_me/railtie.rb
|
61
|
+
- lib/current_me/version.rb
|
62
|
+
- spec/dummy/.gitignore
|
63
|
+
- spec/dummy/.rspec
|
64
|
+
- spec/dummy/Gemfile
|
65
|
+
- spec/dummy/README.rdoc
|
66
|
+
- spec/dummy/Rakefile
|
67
|
+
- spec/dummy/app/assets/images/rails.png
|
68
|
+
- spec/dummy/app/assets/javascripts/application.js
|
69
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
70
|
+
- spec/dummy/app/controllers/application_controller.rb
|
71
|
+
- spec/dummy/app/controllers/rooms_controller.rb
|
72
|
+
- spec/dummy/app/controllers/sessions_controller.rb
|
73
|
+
- spec/dummy/app/controllers/users_controller.rb
|
74
|
+
- spec/dummy/app/helpers/application_helper.rb
|
75
|
+
- spec/dummy/app/mailers/.gitkeep
|
76
|
+
- spec/dummy/app/models/.gitkeep
|
77
|
+
- spec/dummy/app/models/user.rb
|
78
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
79
|
+
- spec/dummy/app/views/rooms/index.html.erb
|
80
|
+
- spec/dummy/app/views/sessions/new.html.erb
|
81
|
+
- spec/dummy/app/views/users/new.html.erb
|
82
|
+
- spec/dummy/app/views/users/show.html.erb
|
83
|
+
- spec/dummy/config.ru
|
84
|
+
- spec/dummy/config/application.rb
|
85
|
+
- spec/dummy/config/boot.rb
|
86
|
+
- spec/dummy/config/database.yml
|
87
|
+
- spec/dummy/config/environment.rb
|
88
|
+
- spec/dummy/config/environments/development.rb
|
89
|
+
- spec/dummy/config/environments/production.rb
|
90
|
+
- spec/dummy/config/environments/test.rb
|
91
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
92
|
+
- spec/dummy/config/initializers/inflections.rb
|
93
|
+
- spec/dummy/config/initializers/mime_types.rb
|
94
|
+
- spec/dummy/config/initializers/secret_token.rb
|
95
|
+
- spec/dummy/config/initializers/session_store.rb
|
96
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
97
|
+
- spec/dummy/config/locales/en.yml
|
98
|
+
- spec/dummy/config/routes.rb
|
99
|
+
- spec/dummy/db/migrate/20120717091510_create_users.rb
|
100
|
+
- spec/dummy/db/schema.rb
|
101
|
+
- spec/dummy/db/seeds.rb
|
102
|
+
- spec/dummy/lib/assets/.gitkeep
|
103
|
+
- spec/dummy/lib/tasks/.gitkeep
|
104
|
+
- spec/dummy/log/.gitkeep
|
105
|
+
- spec/dummy/public/404.html
|
106
|
+
- spec/dummy/public/422.html
|
107
|
+
- spec/dummy/public/500.html
|
108
|
+
- spec/dummy/public/favicon.ico
|
109
|
+
- spec/dummy/public/index.html
|
110
|
+
- spec/dummy/public/robots.txt
|
111
|
+
- spec/dummy/script/rails
|
112
|
+
- spec/dummy/spec/controllers/rooms_controller_spec.rb
|
113
|
+
- spec/dummy/spec/controllers/sessions_controller_spec.rb
|
114
|
+
- spec/dummy/spec/controllers/users_controller_spec.rb
|
115
|
+
- spec/dummy/spec/spec_helper.rb
|
116
|
+
- spec/dummy/test/fixtures/.gitkeep
|
117
|
+
- spec/dummy/test/functional/.gitkeep
|
118
|
+
- spec/dummy/test/integration/.gitkeep
|
119
|
+
- spec/dummy/test/performance/browsing_test.rb
|
120
|
+
- spec/dummy/test/test_helper.rb
|
121
|
+
- spec/dummy/test/unit/.gitkeep
|
122
|
+
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
123
|
+
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
124
|
+
- spec/dummy/vendor/plugins/.gitkeep
|
125
|
+
homepage: https://github.com/akiinyo/current_me
|
126
|
+
licenses: []
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.8.24
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: CurrentMe possesses a current user by a session
|
149
|
+
test_files:
|
150
|
+
- spec/dummy/.gitignore
|
151
|
+
- spec/dummy/.rspec
|
152
|
+
- spec/dummy/Gemfile
|
153
|
+
- spec/dummy/README.rdoc
|
154
|
+
- spec/dummy/Rakefile
|
155
|
+
- spec/dummy/app/assets/images/rails.png
|
156
|
+
- spec/dummy/app/assets/javascripts/application.js
|
157
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
158
|
+
- spec/dummy/app/controllers/application_controller.rb
|
159
|
+
- spec/dummy/app/controllers/rooms_controller.rb
|
160
|
+
- spec/dummy/app/controllers/sessions_controller.rb
|
161
|
+
- spec/dummy/app/controllers/users_controller.rb
|
162
|
+
- spec/dummy/app/helpers/application_helper.rb
|
163
|
+
- spec/dummy/app/mailers/.gitkeep
|
164
|
+
- spec/dummy/app/models/.gitkeep
|
165
|
+
- spec/dummy/app/models/user.rb
|
166
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
167
|
+
- spec/dummy/app/views/rooms/index.html.erb
|
168
|
+
- spec/dummy/app/views/sessions/new.html.erb
|
169
|
+
- spec/dummy/app/views/users/new.html.erb
|
170
|
+
- spec/dummy/app/views/users/show.html.erb
|
171
|
+
- spec/dummy/config.ru
|
172
|
+
- spec/dummy/config/application.rb
|
173
|
+
- spec/dummy/config/boot.rb
|
174
|
+
- spec/dummy/config/database.yml
|
175
|
+
- spec/dummy/config/environment.rb
|
176
|
+
- spec/dummy/config/environments/development.rb
|
177
|
+
- spec/dummy/config/environments/production.rb
|
178
|
+
- spec/dummy/config/environments/test.rb
|
179
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
180
|
+
- spec/dummy/config/initializers/inflections.rb
|
181
|
+
- spec/dummy/config/initializers/mime_types.rb
|
182
|
+
- spec/dummy/config/initializers/secret_token.rb
|
183
|
+
- spec/dummy/config/initializers/session_store.rb
|
184
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
185
|
+
- spec/dummy/config/locales/en.yml
|
186
|
+
- spec/dummy/config/routes.rb
|
187
|
+
- spec/dummy/db/migrate/20120717091510_create_users.rb
|
188
|
+
- spec/dummy/db/schema.rb
|
189
|
+
- spec/dummy/db/seeds.rb
|
190
|
+
- spec/dummy/lib/assets/.gitkeep
|
191
|
+
- spec/dummy/lib/tasks/.gitkeep
|
192
|
+
- spec/dummy/log/.gitkeep
|
193
|
+
- spec/dummy/public/404.html
|
194
|
+
- spec/dummy/public/422.html
|
195
|
+
- spec/dummy/public/500.html
|
196
|
+
- spec/dummy/public/favicon.ico
|
197
|
+
- spec/dummy/public/index.html
|
198
|
+
- spec/dummy/public/robots.txt
|
199
|
+
- spec/dummy/script/rails
|
200
|
+
- spec/dummy/spec/controllers/rooms_controller_spec.rb
|
201
|
+
- spec/dummy/spec/controllers/sessions_controller_spec.rb
|
202
|
+
- spec/dummy/spec/controllers/users_controller_spec.rb
|
203
|
+
- spec/dummy/spec/spec_helper.rb
|
204
|
+
- spec/dummy/test/fixtures/.gitkeep
|
205
|
+
- spec/dummy/test/functional/.gitkeep
|
206
|
+
- spec/dummy/test/integration/.gitkeep
|
207
|
+
- spec/dummy/test/performance/browsing_test.rb
|
208
|
+
- spec/dummy/test/test_helper.rb
|
209
|
+
- spec/dummy/test/unit/.gitkeep
|
210
|
+
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
211
|
+
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
212
|
+
- spec/dummy/vendor/plugins/.gitkeep
|