dailycred 0.1.461 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -2
- data/README.md +43 -15
- data/Rakefile +2 -2
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/views/sessions/info.html.erb +2 -2
- data/config/routes.rb +4 -4
- data/dailycred.gemspec +1 -1
- data/dummy-preauth/.gitignore +16 -0
- data/dummy-preauth/Gemfile +42 -0
- data/dummy-preauth/README.rdoc +28 -0
- data/dummy-preauth/Rakefile +6 -0
- data/dummy-preauth/app/assets/images/rails.png +0 -0
- data/dummy-preauth/app/assets/javascripts/application.js +16 -0
- data/{dummy/app/assets/javascripts/posts.js.coffee → dummy-preauth/app/assets/javascripts/welcome.js.coffee} +1 -1
- data/dummy-preauth/app/assets/stylesheets/application.css +13 -0
- data/{dummy/app/assets/stylesheets/posts.css.scss → dummy-preauth/app/assets/stylesheets/welcome.css.scss} +1 -1
- data/dummy-preauth/app/controllers/application_controller.rb +6 -0
- data/{dummy/app/mailers/.gitkeep → dummy-preauth/app/controllers/concerns/.keep} +0 -0
- data/dummy-preauth/app/controllers/sessions_controller.rb +34 -0
- data/dummy-preauth/app/controllers/users_controller.rb +30 -0
- data/dummy-preauth/app/controllers/welcome_controller.rb +9 -0
- data/dummy-preauth/app/helpers/application_helper.rb +2 -0
- data/dummy-preauth/app/helpers/sessions_helper.rb +2 -0
- data/dummy-preauth/app/helpers/users_helper.rb +2 -0
- data/dummy-preauth/app/helpers/welcome_helper.rb +2 -0
- data/{dummy/app/models/.gitkeep → dummy-preauth/app/mailers/.keep} +0 -0
- data/{dummy/lib/assets/.gitkeep → dummy-preauth/app/models/.keep} +0 -0
- data/{dummy/lib/tasks/.gitkeep → dummy-preauth/app/models/concerns/.keep} +0 -0
- data/dummy-preauth/app/models/user.rb +34 -0
- data/dummy-preauth/app/views/layouts/application.html.erb +14 -0
- data/dummy-preauth/app/views/sessions/new.html.erb +15 -0
- data/dummy-preauth/app/views/users/_form.html.erb +20 -0
- data/dummy-preauth/app/views/users/edit.html.erb +3 -0
- data/dummy-preauth/app/views/users/new.html.erb +5 -0
- data/dummy-preauth/app/views/welcome/index.html.erb +2 -0
- data/dummy-preauth/bin/bundle +3 -0
- data/dummy-preauth/bin/rails +4 -0
- data/dummy-preauth/bin/rake +4 -0
- data/dummy-preauth/config.ru +4 -0
- data/dummy-preauth/config/application.rb +22 -0
- data/dummy-preauth/config/boot.rb +4 -0
- data/dummy-preauth/config/database.yml +25 -0
- data/dummy-preauth/config/environment.rb +5 -0
- data/dummy-preauth/config/environments/development.rb +27 -0
- data/dummy-preauth/config/environments/production.rb +80 -0
- data/dummy-preauth/config/environments/test.rb +36 -0
- data/dummy-preauth/config/initializers/backtrace_silencers.rb +7 -0
- data/dummy-preauth/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy-preauth/config/initializers/inflections.rb +16 -0
- data/dummy-preauth/config/initializers/mime_types.rb +5 -0
- data/dummy-preauth/config/initializers/omniauth.rb +9 -0
- data/dummy-preauth/config/initializers/secret_token.rb +12 -0
- data/dummy-preauth/config/initializers/session_store.rb +3 -0
- data/dummy-preauth/config/initializers/wrap_parameters.rb +14 -0
- data/dummy-preauth/config/locales/en.yml +23 -0
- data/dummy-preauth/config/routes.rb +57 -0
- data/dummy-preauth/db/migrate/20130423011519_create_users.rb +15 -0
- data/dummy-preauth/db/migrate/20130423011738_add_uuid_to_users.rb +5 -0
- data/dummy-preauth/db/schema.rb +26 -0
- data/dummy-preauth/db/seeds.rb +7 -0
- data/{dummy/log/.gitkeep → dummy-preauth/lib/assets/.keep} +0 -0
- data/dummy-preauth/lib/controller_authentication.rb +48 -0
- data/{dummy/test/fixtures/.gitkeep → dummy-preauth/lib/tasks/.keep} +0 -0
- data/{dummy/test/functional/.gitkeep → dummy-preauth/log/.keep} +0 -0
- data/dummy-preauth/public/404.html +27 -0
- data/dummy-preauth/public/422.html +26 -0
- data/dummy-preauth/public/500.html +26 -0
- data/{dummy/test/integration/.gitkeep → dummy-preauth/public/favicon.ico} +0 -0
- data/dummy-preauth/public/robots.txt +5 -0
- data/{dummy/test/unit/.gitkeep → dummy-preauth/test/controllers/.keep} +0 -0
- data/dummy-preauth/test/controllers/welcome_controller_test.rb +9 -0
- data/{dummy/vendor/assets/javascripts/.gitkeep → dummy-preauth/test/fixtures/.keep} +0 -0
- data/dummy-preauth/test/fixtures/users.yml +12 -0
- data/dummy-preauth/test/functional/sessions_controller_test.rb +22 -0
- data/dummy-preauth/test/functional/users_controller_test.rb +51 -0
- data/{dummy/vendor/assets/stylesheets/.gitkeep → dummy-preauth/test/helpers/.keep} +0 -0
- data/dummy-preauth/test/helpers/welcome_helper_test.rb +4 -0
- data/{dummy/vendor/plugins/.gitkeep → dummy-preauth/test/integration/.keep} +0 -0
- data/dummy-preauth/test/mailers/.keep +0 -0
- data/dummy-preauth/test/models/.keep +0 -0
- data/dummy-preauth/test/test_helper.rb +15 -0
- data/dummy-preauth/test/unit/user_test.rb +86 -0
- data/dummy-preauth/vendor/assets/javascripts/.keep +0 -0
- data/dummy-preauth/vendor/assets/stylesheets/.keep +0 -0
- data/dummy/.gitignore +3 -2
- data/dummy/Gemfile +14 -28
- data/dummy/README.rdoc +15 -248
- data/dummy/Rakefile +0 -1
- data/dummy/app/assets/javascripts/application.js +2 -1
- data/dummy/app/controllers/application_controller.rb +5 -4
- data/dummy/app/controllers/concerns/.keep +0 -0
- data/dummy/app/mailers/.keep +0 -0
- data/dummy/app/models/.keep +0 -0
- data/dummy/app/models/concerns/.keep +0 -0
- data/dummy/app/views/layouts/application.html.erb +2 -6
- data/dummy/bin/bundle +3 -0
- data/dummy/bin/rails +4 -0
- data/dummy/bin/rake +4 -0
- data/dummy/config/application.rb +2 -42
- data/dummy/config/boot.rb +0 -2
- data/dummy/config/environment.rb +2 -2
- data/dummy/config/environments/development.rb +9 -19
- data/dummy/config/environments/production.rb +40 -27
- data/dummy/config/environments/test.rb +12 -13
- data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy/config/initializers/inflections.rb +6 -5
- data/dummy/config/initializers/omniauth.rb +9 -2
- data/dummy/config/initializers/secret_token.rb +6 -1
- data/dummy/config/initializers/session_store.rb +1 -6
- data/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/dummy/config/locales/en.yml +20 -2
- data/dummy/config/routes.rb +15 -26
- data/dummy/db/migrate/{20120925172903_create_users.rb → 20130417131939_create_users.rb} +7 -11
- data/dummy/db/schema.rb +9 -19
- data/dummy/lib/assets/.keep +0 -0
- data/dummy/lib/tasks/.keep +0 -0
- data/dummy/log/.keep +0 -0
- data/dummy/public/404.html +2 -1
- data/dummy/public/422.html +1 -1
- data/dummy/public/500.html +2 -1
- data/dummy/public/robots.txt +1 -1
- data/dummy/test/controllers/.keep +0 -0
- data/dummy/test/fixtures/.keep +0 -0
- data/dummy/test/helpers/.keep +0 -0
- data/dummy/test/integration/.keep +0 -0
- data/dummy/test/mailers/.keep +0 -0
- data/dummy/test/models/.keep +0 -0
- data/dummy/test/test_helper.rb +11 -58
- data/dummy/vendor/assets/javascripts/.keep +0 -0
- data/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/lib/dailycred.rb +2 -2
- data/lib/dailycred/acts_as_dailycred.rb +4 -17
- data/lib/dailycred/client.rb +1 -0
- data/lib/dailycred/engine.rb +3 -2
- data/lib/dailycred/helper.rb +4 -4
- data/lib/dailycred/middleware.rb +5 -2
- data/lib/dailycred/version.rb +1 -1
- data/lib/generators/dailycred_generator.rb +17 -8
- data/lib/generators/templates/migration_create_user.rb +3 -9
- data/lib/omniauth/strategies/dailycred.rb +2 -0
- data/spec/helper_spec.rb +1 -3
- data/test/generator_test.rb +4 -3
- metadata +103 -52
- data/dummy/Guardfile +0 -31
- data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
- data/dummy/app/controllers/posts_controller.rb +0 -86
- data/dummy/app/helpers/posts_helper.rb +0 -2
- data/dummy/app/models/post.rb +0 -3
- data/dummy/app/views/posts/_form.html.erb +0 -21
- data/dummy/app/views/posts/edit.html.erb +0 -6
- data/dummy/app/views/posts/index.html.erb +0 -23
- data/dummy/app/views/posts/new.html.erb +0 -5
- data/dummy/app/views/posts/show.html.erb +0 -10
- data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
- data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
- data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
- data/dummy/public/index.html +0 -241
- data/dummy/script/rails +0 -6
- data/dummy/test/fixtures/posts.yml +0 -7
- data/dummy/test/fixtures/users.yml +0 -3
- data/dummy/test/functional/posts_controller_test.rb +0 -51
- data/dummy/test/performance/browsing_test.rb +0 -12
- data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
- data/dummy/test/unit/post_test.rb +0 -7
- data/dummy/test/unit/user_test.rb +0 -77
- data/spec/omniauth/strategies/dailycred_spec.rb +0 -64
data/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PostsControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@post = posts(:one)
|
6
|
-
@user = users(:basic)
|
7
|
-
@controller.stubs(:current_user).returns(@user)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get index" do
|
11
|
-
get :index
|
12
|
-
assert_response :success
|
13
|
-
assert_not_nil assigns(:posts)
|
14
|
-
end
|
15
|
-
|
16
|
-
test "should get new" do
|
17
|
-
get :new
|
18
|
-
assert_response :success
|
19
|
-
end
|
20
|
-
|
21
|
-
test "should create post" do
|
22
|
-
assert_difference('Post.count') do
|
23
|
-
post :create, post: { title: @post.title }
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_redirected_to post_path(assigns(:post))
|
27
|
-
end
|
28
|
-
|
29
|
-
test "should show post" do
|
30
|
-
get :show, id: @post
|
31
|
-
assert_response :success
|
32
|
-
end
|
33
|
-
|
34
|
-
test "should get edit" do
|
35
|
-
get :edit, id: @post
|
36
|
-
assert_response :success
|
37
|
-
end
|
38
|
-
|
39
|
-
test "should update post" do
|
40
|
-
put :update, id: @post, post: { title: @post.title }
|
41
|
-
assert_redirected_to post_path(assigns(:post))
|
42
|
-
end
|
43
|
-
|
44
|
-
test "should destroy post" do
|
45
|
-
assert_difference('Post.count', -1) do
|
46
|
-
delete :destroy, id: @post
|
47
|
-
end
|
48
|
-
|
49
|
-
assert_redirected_to posts_path
|
50
|
-
end
|
51
|
-
end
|
@@ -1,12 +0,0 @@
|
|
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
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require_relative '../test_helper.rb'
|
2
|
-
class UserTest < ActiveSupport::TestCase
|
3
|
-
setup do
|
4
|
-
@user = users(:basic)
|
5
|
-
end
|
6
|
-
test 'tagging a user' do
|
7
|
-
@user.tag 'awesome'
|
8
|
-
assert_tag 'awesome'
|
9
|
-
end
|
10
|
-
test 'untagging a user' do
|
11
|
-
t = 'bad'
|
12
|
-
@user.tag t
|
13
|
-
assert_tag t
|
14
|
-
@user.untag t
|
15
|
-
assert_not_tag t
|
16
|
-
end
|
17
|
-
|
18
|
-
test 'resetting a password' do
|
19
|
-
assert_true json_response(@user.reset_password)['worked']
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'updating from dailycred' do
|
23
|
-
dc = {
|
24
|
-
email: 'hank@2.com',
|
25
|
-
tags: ['hello','awesome'],
|
26
|
-
referred: ['danny', 'betty'],
|
27
|
-
username: 'hstove',
|
28
|
-
created: 111222333,
|
29
|
-
verified: false,
|
30
|
-
admin: false,
|
31
|
-
referred_by: 'marky',
|
32
|
-
referred: ['chris', 'mike'],
|
33
|
-
facebook: {
|
34
|
-
id: 100203,
|
35
|
-
email: 'hank@facebook.com'
|
36
|
-
},
|
37
|
-
provider: 'dailycred',
|
38
|
-
token: 'ha243k',
|
39
|
-
twitter: {
|
40
|
-
screen_name: 'heynky'
|
41
|
-
},
|
42
|
-
google: {
|
43
|
-
email: 'hstove@gg.com'
|
44
|
-
},
|
45
|
-
github: {
|
46
|
-
repos: ['123','ruby on rails']
|
47
|
-
},
|
48
|
-
subscribed: false,
|
49
|
-
display: 'hanky'
|
50
|
-
}
|
51
|
-
@user.update_from_dailycred dc
|
52
|
-
dc.each do |k,v|
|
53
|
-
assert_equal v, @user[k], "user should have value of |#{v}| for |#{k}| but was |#{@user[k].to_s}|"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
test 'firing an event' do
|
58
|
-
assert_true json_response(@user.fire_event 'got tested')['worked']
|
59
|
-
end
|
60
|
-
|
61
|
-
test 'making a referral link' do
|
62
|
-
id = @user.uid
|
63
|
-
assert_equal @user.referral_link('http://me.com'), "https://www.dailycred.com/r/#{id}?redirect_uri=http://me.com"
|
64
|
-
end
|
65
|
-
|
66
|
-
def json_response response
|
67
|
-
JSON.parse response.body
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
def assert_tag tag
|
72
|
-
assert_true @user.tags.include?(tag), "user should have tag: #{tag} but has tags: #{@user.tags}"
|
73
|
-
end
|
74
|
-
def assert_not_tag tag
|
75
|
-
assert_false @user.tags.include?(tag), "user should not have tag: #{tag} but has tags: #{@user.tags}"
|
76
|
-
end
|
77
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require_relative '../../helper_spec.rb'
|
2
|
-
require 'omniauth'
|
3
|
-
require 'dailycred'
|
4
|
-
describe OmniAuth::Strategies::Dailycred do
|
5
|
-
subject do
|
6
|
-
OmniAuth::Strategies::Dailycred.new(nil, @options || {})
|
7
|
-
end
|
8
|
-
|
9
|
-
OmniAuth.config.test_mode = true
|
10
|
-
OmniAuth.config.add_mock(:dailycred, {:id => '12345',
|
11
|
-
:email => 'Test@test.com',
|
12
|
-
:username => 'test',
|
13
|
-
:created => 45678,
|
14
|
-
:verified => false,
|
15
|
-
:admin => true,
|
16
|
-
:referred_by => 'dave' })
|
17
|
-
|
18
|
-
it_should_behave_like 'an oauth2 strategy'
|
19
|
-
|
20
|
-
|
21
|
-
describe '#client' do
|
22
|
-
it 'should have the correct dailycred site' do
|
23
|
-
subject.client.site.should eq("https://www.dailycred.com")
|
24
|
-
end
|
25
|
-
it 'should have the correct authorization url' do
|
26
|
-
subject.client.options[:authorize_url].should eq("/connect")
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should have the correct token url' do
|
30
|
-
subject.client.options[:token_url].should eq('/oauth/access_token')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# describe 'getting info' do
|
35
|
-
# before do
|
36
|
-
# @access_token = double("token" => 'test_token')
|
37
|
-
# @dailycred_user = double( :id => '12345',
|
38
|
-
# :email => 'test@test.com',
|
39
|
-
# :username => 'test',
|
40
|
-
# :id => 45678,
|
41
|
-
# :verified => false,
|
42
|
-
# :admin => true,
|
43
|
-
# :referred_by => 'dave' )
|
44
|
-
|
45
|
-
# subject.stub(:access_token) { @access_token }
|
46
|
-
|
47
|
-
# @dailycred_user.should_receive(:fetch).and_return(@dailycred_user)
|
48
|
-
# end
|
49
|
-
|
50
|
-
# it 'should set the correct info based on user' do
|
51
|
-
# subject.info.should == {:id => '12345',
|
52
|
-
# :email => 'test@test.com',
|
53
|
-
# :username => 'test',
|
54
|
-
# :created => 45678,
|
55
|
-
# :verified => false,
|
56
|
-
# :admin => true,
|
57
|
-
# :referred_by => 'dave' }
|
58
|
-
# end
|
59
|
-
|
60
|
-
# it 'set the correct uid based on user' do
|
61
|
-
# subject.id.should == '12345'
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
end
|