muck-profiles 0.1.15 → 0.1.16
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/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/app/views/profiles/index.html.erb +3 -2
- data/muck-profiles.gemspec +5 -14
- data/test/rails_root/config/environment.rb +2 -2
- data/test/rails_root/config/environments/test.rb +0 -9
- data/test/rails_root/test/test_helper.rb +4 -31
- metadata +5 -13
- data/test/rails_root/Capfile +0 -3
- data/test/rails_root/test/factories.rb +0 -56
- data/test/rails_root/test/mocks/development/.keep +0 -0
- data/test/rails_root/test/mocks/test/.keep +0 -0
- data/test/rails_root/test/shoulda_macros/controller.rb +0 -49
- data/test/rails_root/test/shoulda_macros/models.rb +0 -50
data/README.rdoc
CHANGED
|
@@ -38,4 +38,4 @@ Your user model will now appear to have a 'photo' which is delegated to the prof
|
|
|
38
38
|
|
|
39
39
|
@user.photo # returns a photo object from paperclip
|
|
40
40
|
|
|
41
|
-
Copyright (c) 2009
|
|
41
|
+
Copyright (c) 2009 Tatemae, released under the MIT license
|
data/Rakefile
CHANGED
|
@@ -49,10 +49,10 @@ begin
|
|
|
49
49
|
Jeweler::Tasks.new do |gemspec|
|
|
50
50
|
gemspec.name = "muck-profiles"
|
|
51
51
|
gemspec.summary = "Profile engine for the muck system"
|
|
52
|
-
gemspec.email = "
|
|
53
|
-
gemspec.homepage = "http://github.com/
|
|
52
|
+
gemspec.email = "justin@tatemae.com"
|
|
53
|
+
gemspec.homepage = "http://github.com/tatemae/muck_profiles"
|
|
54
54
|
gemspec.description = "Profile engine for the muck system."
|
|
55
|
-
gemspec.authors = ["Justin Ball"]
|
|
55
|
+
gemspec.authors = ["Justin Ball", "Joel Duffin"]
|
|
56
56
|
gemspec.rubyforge_project = 'muck-profiles'
|
|
57
57
|
gemspec.add_dependency "muck-engine"
|
|
58
58
|
gemspec.add_dependency "muck-users"
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.16
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<div id="profiles">
|
|
2
|
+
<%= render :partial => 'profiles/profile_icon', :collection => @users, :as => :user %>
|
|
3
|
+
</div>
|
data/muck-profiles.gemspec
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{muck-profiles}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.16"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = ["Justin Ball"]
|
|
12
|
-
s.date = %q{2009-11-
|
|
11
|
+
s.authors = ["Justin Ball", "Joel Duffin"]
|
|
12
|
+
s.date = %q{2009-11-13}
|
|
13
13
|
s.description = %q{Profile engine for the muck system.}
|
|
14
|
-
s.email = %q{
|
|
14
|
+
s.email = %q{justin@tatemae.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
16
16
|
"README.rdoc"
|
|
17
17
|
]
|
|
@@ -89,7 +89,6 @@ Gem::Specification.new do |s|
|
|
|
89
89
|
"tasks/rails.rake",
|
|
90
90
|
"test/rails_root/.gitignore",
|
|
91
91
|
"test/rails_root/.rake_tasks",
|
|
92
|
-
"test/rails_root/Capfile",
|
|
93
92
|
"test/rails_root/Rakefile",
|
|
94
93
|
"test/rails_root/app/controllers/application_controller.rb",
|
|
95
94
|
"test/rails_root/app/controllers/default_controller.rb",
|
|
@@ -275,15 +274,10 @@ Gem::Specification.new do |s|
|
|
|
275
274
|
"test/rails_root/script/process/spawner",
|
|
276
275
|
"test/rails_root/script/runner",
|
|
277
276
|
"test/rails_root/script/server",
|
|
278
|
-
"test/rails_root/test/factories.rb",
|
|
279
277
|
"test/rails_root/test/functional/.keep",
|
|
280
278
|
"test/rails_root/test/functional/admin/profiles_controller_test.rb",
|
|
281
279
|
"test/rails_root/test/functional/profiles_controller_test.rb",
|
|
282
280
|
"test/rails_root/test/integration/.keep",
|
|
283
|
-
"test/rails_root/test/mocks/development/.keep",
|
|
284
|
-
"test/rails_root/test/mocks/test/.keep",
|
|
285
|
-
"test/rails_root/test/shoulda_macros/controller.rb",
|
|
286
|
-
"test/rails_root/test/shoulda_macros/models.rb",
|
|
287
281
|
"test/rails_root/test/test_helper.rb",
|
|
288
282
|
"test/rails_root/test/unit/.keep",
|
|
289
283
|
"test/rails_root/test/unit/profile_test.rb",
|
|
@@ -293,7 +287,7 @@ Gem::Specification.new do |s|
|
|
|
293
287
|
"test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb",
|
|
294
288
|
"uninstall.rb"
|
|
295
289
|
]
|
|
296
|
-
s.homepage = %q{http://github.com/
|
|
290
|
+
s.homepage = %q{http://github.com/tatemae/muck_profiles}
|
|
297
291
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
298
292
|
s.require_paths = ["lib"]
|
|
299
293
|
s.rubyforge_project = %q{muck-profiles}
|
|
@@ -325,11 +319,8 @@ Gem::Specification.new do |s|
|
|
|
325
319
|
"test/rails_root/features/support/env.rb",
|
|
326
320
|
"test/rails_root/public/dispatch.rb",
|
|
327
321
|
"test/rails_root/script/create_project.rb",
|
|
328
|
-
"test/rails_root/test/factories.rb",
|
|
329
322
|
"test/rails_root/test/functional/admin/profiles_controller_test.rb",
|
|
330
323
|
"test/rails_root/test/functional/profiles_controller_test.rb",
|
|
331
|
-
"test/rails_root/test/shoulda_macros/controller.rb",
|
|
332
|
-
"test/rails_root/test/shoulda_macros/models.rb",
|
|
333
324
|
"test/rails_root/test/test_helper.rb",
|
|
334
325
|
"test/rails_root/test/unit/profile_test.rb",
|
|
335
326
|
"test/rails_root/test/unit/user_test.rb",
|
|
@@ -17,9 +17,9 @@ Rails::Initializer.run do |config|
|
|
|
17
17
|
config.time_zone = 'UTC'
|
|
18
18
|
config.gem "authlogic"
|
|
19
19
|
config.gem "searchlogic"
|
|
20
|
-
config.gem '
|
|
20
|
+
config.gem 'will_paginate'
|
|
21
21
|
config.gem "bcrypt-ruby", :lib => "bcrypt"
|
|
22
|
-
config.gem '
|
|
22
|
+
config.gem 'paperclip'
|
|
23
23
|
config.gem 'muck-engine', :lib => 'muck_engine'
|
|
24
24
|
config.gem 'muck-users', :lib => 'muck_users'
|
|
25
25
|
config.plugin_locators << TestGemLocator
|
|
@@ -22,12 +22,3 @@ config.action_controller.allow_forgery_protection = false
|
|
|
22
22
|
config.action_mailer.delivery_method = :test
|
|
23
23
|
|
|
24
24
|
HOST = "localhost"
|
|
25
|
-
|
|
26
|
-
config.gem 'thoughtbot-shoulda',
|
|
27
|
-
:lib => 'shoulda',
|
|
28
|
-
:source => "http://gems.github.com",
|
|
29
|
-
:version => '>= 2.9.1'
|
|
30
|
-
config.gem 'thoughtbot-factory_girl',
|
|
31
|
-
:lib => 'factory_girl',
|
|
32
|
-
:source => "http://gems.github.com",
|
|
33
|
-
:version => '>= 1.2.0'
|
|
@@ -1,38 +1,11 @@
|
|
|
1
1
|
$:.reject! { |e| e.include? 'TextMate' }
|
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require 'factory_girl'
|
|
7
|
-
require 'mocha'
|
|
4
|
+
gem 'muck-engine'
|
|
5
|
+
require 'muck_test_helper'
|
|
8
6
|
require 'authlogic/test_case'
|
|
9
|
-
require 'redgreen' rescue LoadError
|
|
10
|
-
require File.expand_path(File.dirname(__FILE__) + '/factories')
|
|
11
|
-
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'controller')
|
|
12
|
-
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'models')
|
|
13
|
-
|
|
14
|
-
class ActiveSupport::TestCase
|
|
15
|
-
self.use_transactional_fixtures = true
|
|
16
|
-
self.use_instantiated_fixtures = false
|
|
17
7
|
|
|
8
|
+
class ActiveSupport::TestCase
|
|
9
|
+
include MuckTestMethods
|
|
18
10
|
include Authlogic::TestCase
|
|
19
|
-
|
|
20
|
-
def login_as(user)
|
|
21
|
-
success = UserSession.create(user)
|
|
22
|
-
if !success
|
|
23
|
-
errors = user.errors.full_messages.to_sentence
|
|
24
|
-
message = 'User has not been activated' if !user.active?
|
|
25
|
-
raise "could not login as #{user.to_param}. Please make sure the user is valid. #{message} #{errors}"
|
|
26
|
-
end
|
|
27
|
-
UserSession.find
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def assure_logout
|
|
31
|
-
user_session = UserSession.find
|
|
32
|
-
user_session.destroy if user_session
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def ensure_flash(val)
|
|
36
|
-
assert_contains flash.values, val, ", Flash: #{flash.inspect}"
|
|
37
|
-
end
|
|
38
11
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: muck-profiles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Ball
|
|
8
|
+
- Joel Duffin
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
12
|
|
|
12
|
-
date: 2009-11-
|
|
13
|
+
date: 2009-11-13 00:00:00 -07:00
|
|
13
14
|
default_executable:
|
|
14
15
|
dependencies:
|
|
15
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -33,7 +34,7 @@ dependencies:
|
|
|
33
34
|
version: "0"
|
|
34
35
|
version:
|
|
35
36
|
description: Profile engine for the muck system.
|
|
36
|
-
email:
|
|
37
|
+
email: justin@tatemae.com
|
|
37
38
|
executables: []
|
|
38
39
|
|
|
39
40
|
extensions: []
|
|
@@ -114,7 +115,6 @@ files:
|
|
|
114
115
|
- tasks/rails.rake
|
|
115
116
|
- test/rails_root/.gitignore
|
|
116
117
|
- test/rails_root/.rake_tasks
|
|
117
|
-
- test/rails_root/Capfile
|
|
118
118
|
- test/rails_root/Rakefile
|
|
119
119
|
- test/rails_root/app/controllers/application_controller.rb
|
|
120
120
|
- test/rails_root/app/controllers/default_controller.rb
|
|
@@ -300,15 +300,10 @@ files:
|
|
|
300
300
|
- test/rails_root/script/process/spawner
|
|
301
301
|
- test/rails_root/script/runner
|
|
302
302
|
- test/rails_root/script/server
|
|
303
|
-
- test/rails_root/test/factories.rb
|
|
304
303
|
- test/rails_root/test/functional/.keep
|
|
305
304
|
- test/rails_root/test/functional/admin/profiles_controller_test.rb
|
|
306
305
|
- test/rails_root/test/functional/profiles_controller_test.rb
|
|
307
306
|
- test/rails_root/test/integration/.keep
|
|
308
|
-
- test/rails_root/test/mocks/development/.keep
|
|
309
|
-
- test/rails_root/test/mocks/test/.keep
|
|
310
|
-
- test/rails_root/test/shoulda_macros/controller.rb
|
|
311
|
-
- test/rails_root/test/shoulda_macros/models.rb
|
|
312
307
|
- test/rails_root/test/test_helper.rb
|
|
313
308
|
- test/rails_root/test/unit/.keep
|
|
314
309
|
- test/rails_root/test/unit/profile_test.rb
|
|
@@ -318,7 +313,7 @@ files:
|
|
|
318
313
|
- test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb
|
|
319
314
|
- uninstall.rb
|
|
320
315
|
has_rdoc: true
|
|
321
|
-
homepage: http://github.com/
|
|
316
|
+
homepage: http://github.com/tatemae/muck_profiles
|
|
322
317
|
licenses: []
|
|
323
318
|
|
|
324
319
|
post_install_message:
|
|
@@ -371,11 +366,8 @@ test_files:
|
|
|
371
366
|
- test/rails_root/features/support/env.rb
|
|
372
367
|
- test/rails_root/public/dispatch.rb
|
|
373
368
|
- test/rails_root/script/create_project.rb
|
|
374
|
-
- test/rails_root/test/factories.rb
|
|
375
369
|
- test/rails_root/test/functional/admin/profiles_controller_test.rb
|
|
376
370
|
- test/rails_root/test/functional/profiles_controller_test.rb
|
|
377
|
-
- test/rails_root/test/shoulda_macros/controller.rb
|
|
378
|
-
- test/rails_root/test/shoulda_macros/models.rb
|
|
379
371
|
- test/rails_root/test/test_helper.rb
|
|
380
372
|
- test/rails_root/test/unit/profile_test.rb
|
|
381
373
|
- test/rails_root/test/unit/user_test.rb
|
data/test/rails_root/Capfile
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
Factory.sequence :email do |n|
|
|
2
|
-
"somebody#{n}@example.com"
|
|
3
|
-
end
|
|
4
|
-
|
|
5
|
-
Factory.sequence :login do |n|
|
|
6
|
-
"inquire#{n}"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
Factory.sequence :name do |n|
|
|
10
|
-
"a_name#{n}"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
Factory.sequence :abbr do |n|
|
|
14
|
-
"abbr#{n}"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
Factory.sequence :description do |n|
|
|
18
|
-
"This is the description: #{n}"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Factory.define :state do |f|
|
|
22
|
-
f.name { Factory.next(:name) }
|
|
23
|
-
f.abbreviation { Factory.next(:abbr) }
|
|
24
|
-
f.country {|a| a.association(:country) }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
Factory.define :country do |f|
|
|
28
|
-
f.name { Factory.next(:name) }
|
|
29
|
-
f.abbreviation { Factory.next(:abbr) }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Factory.define :user do |f|
|
|
33
|
-
f.login { Factory.next(:login) }
|
|
34
|
-
f.email { Factory.next(:email) }
|
|
35
|
-
f.password 'inquire_pass'
|
|
36
|
-
f.password_confirmation 'inquire_pass'
|
|
37
|
-
f.first_name 'test'
|
|
38
|
-
f.last_name 'guy'
|
|
39
|
-
f.terms_of_service true
|
|
40
|
-
f.activated_at DateTime.now
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
Factory.define :content_page do |f|
|
|
44
|
-
f.creator {|a| a.association(:user)}
|
|
45
|
-
f.title { Factory.next(:name) }
|
|
46
|
-
f.body_raw { Factory.next(:description) }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
Factory.define :permission do |f|
|
|
50
|
-
f.role {|a| a.association(:role)}
|
|
51
|
-
f.user {|a| a.association(:user)}
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
Factory.define :role do |f|
|
|
55
|
-
f.rolename 'administrator'
|
|
56
|
-
end
|
|
File without changes
|
|
File without changes
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
module MuckControllerMacros
|
|
2
|
-
|
|
3
|
-
def should_require_login(*args)
|
|
4
|
-
args = Hash[*args]
|
|
5
|
-
login_url = args.delete :login_url
|
|
6
|
-
args.each do |action, verb|
|
|
7
|
-
should "Require login for '#{action}' action" do
|
|
8
|
-
if [:put, :delete].include?(verb) # put and delete require an id even if it is a bogus one
|
|
9
|
-
send(verb, action, :id => 1)
|
|
10
|
-
else
|
|
11
|
-
send(verb, action)
|
|
12
|
-
end
|
|
13
|
-
assert_redirected_to(login_url)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def should_require_role(role, redirect_url, *actions)
|
|
19
|
-
actions.each do |action|
|
|
20
|
-
should "require role for '#{action}' action" do
|
|
21
|
-
get(action)
|
|
22
|
-
ensure_flash(/permission/i)
|
|
23
|
-
assert_response :redirect
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
#from: http://blog.internautdesign.com/2008/9/11/more-on-custom-shoulda-macros-scoping-of-instance-variables
|
|
29
|
-
def should_not_allow action, object, url= "/login", msg=nil
|
|
30
|
-
msg ||= "a #{object.class.to_s.downcase}"
|
|
31
|
-
should "not be able to #{action} #{msg}" do
|
|
32
|
-
object = eval(object, self.send(:binding), __FILE__, __LINE__)
|
|
33
|
-
get action, :id => object.id
|
|
34
|
-
assert_redirected_to url
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def should_allow action, object, msg=nil
|
|
39
|
-
msg ||= "a #{object.class.to_s.downcase}"
|
|
40
|
-
should "be able to #{action} #{msg}" do
|
|
41
|
-
object = eval(object, self.send(:binding), __FILE__, __LINE__)
|
|
42
|
-
get action, :id => object.id
|
|
43
|
-
assert_response :success
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
ActionController::TestCase.extend(MuckControllerMacros)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module ShouldaModelMacros
|
|
2
|
-
|
|
3
|
-
def self.should_whitelist(*attributes)
|
|
4
|
-
bad_scripts = [
|
|
5
|
-
%|';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>|,
|
|
6
|
-
%|'';!--"<XSS>=&{()}|,
|
|
7
|
-
%|<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>|,
|
|
8
|
-
%|<IMG SRC="javascript:alert('XSS');">|,
|
|
9
|
-
%|<IMG SRC=javascript:alert('XSS')>|,
|
|
10
|
-
%|<IMG SRC=JaVaScRiPt:alert('XSS')>|,
|
|
11
|
-
%|<IMG SRC=JaVaScRiPt:alert('XSS')>|,
|
|
12
|
-
%|<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>|,
|
|
13
|
-
%|<IMG """><SCRIPT>alert("XSS")</SCRIPT>">|,
|
|
14
|
-
%|<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>|,
|
|
15
|
-
%|<A HREF="h
|
|
16
|
-
tt p://6	6.000146.0x7.147/">XSS</A>|,
|
|
17
|
-
%|<script>alert('message');</script>| ]
|
|
18
|
-
|
|
19
|
-
klass = model_class
|
|
20
|
-
attributes.each do |attribute|
|
|
21
|
-
attribute = attribute.to_sym
|
|
22
|
-
should "white list #{attribute}" do
|
|
23
|
-
assert object = klass.find(:first), "Can't find first #{klass}"
|
|
24
|
-
bad_scripts.each do |bad_value|
|
|
25
|
-
object.send("#{attribute}=", bad_value)
|
|
26
|
-
object.save
|
|
27
|
-
clean_value = object.send("#{attribute}")
|
|
28
|
-
assert !clean_value.include?(bad_value), "#{attribute} is not white listed. #{bad_value} made it through"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def should_accept_nested_attributes_for(*attr_names)
|
|
35
|
-
klass = self.name.gsub(/Test$/, '').constantize
|
|
36
|
-
|
|
37
|
-
context "#{klass}" do
|
|
38
|
-
attr_names.each do |association_name|
|
|
39
|
-
should "accept nested attrs for #{association_name}" do
|
|
40
|
-
assert klass.instance_methods.include?("#{association_name}_attributes="),
|
|
41
|
-
"#{klass} does not accept nested attributes for #{association_name}"
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class ActiveSupport::TestCase
|
|
49
|
-
extend ShouldaModelMacros
|
|
50
|
-
end
|