dailycred 0.1.461 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -2
  3. data/README.md +43 -15
  4. data/Rakefile +2 -2
  5. data/app/controllers/sessions_controller.rb +1 -1
  6. data/app/views/sessions/info.html.erb +2 -2
  7. data/config/routes.rb +4 -4
  8. data/dailycred.gemspec +1 -1
  9. data/dummy-preauth/.gitignore +16 -0
  10. data/dummy-preauth/Gemfile +42 -0
  11. data/dummy-preauth/README.rdoc +28 -0
  12. data/dummy-preauth/Rakefile +6 -0
  13. data/dummy-preauth/app/assets/images/rails.png +0 -0
  14. data/dummy-preauth/app/assets/javascripts/application.js +16 -0
  15. data/{dummy/app/assets/javascripts/posts.js.coffee → dummy-preauth/app/assets/javascripts/welcome.js.coffee} +1 -1
  16. data/dummy-preauth/app/assets/stylesheets/application.css +13 -0
  17. data/{dummy/app/assets/stylesheets/posts.css.scss → dummy-preauth/app/assets/stylesheets/welcome.css.scss} +1 -1
  18. data/dummy-preauth/app/controllers/application_controller.rb +6 -0
  19. data/{dummy/app/mailers/.gitkeep → dummy-preauth/app/controllers/concerns/.keep} +0 -0
  20. data/dummy-preauth/app/controllers/sessions_controller.rb +34 -0
  21. data/dummy-preauth/app/controllers/users_controller.rb +30 -0
  22. data/dummy-preauth/app/controllers/welcome_controller.rb +9 -0
  23. data/dummy-preauth/app/helpers/application_helper.rb +2 -0
  24. data/dummy-preauth/app/helpers/sessions_helper.rb +2 -0
  25. data/dummy-preauth/app/helpers/users_helper.rb +2 -0
  26. data/dummy-preauth/app/helpers/welcome_helper.rb +2 -0
  27. data/{dummy/app/models/.gitkeep → dummy-preauth/app/mailers/.keep} +0 -0
  28. data/{dummy/lib/assets/.gitkeep → dummy-preauth/app/models/.keep} +0 -0
  29. data/{dummy/lib/tasks/.gitkeep → dummy-preauth/app/models/concerns/.keep} +0 -0
  30. data/dummy-preauth/app/models/user.rb +34 -0
  31. data/dummy-preauth/app/views/layouts/application.html.erb +14 -0
  32. data/dummy-preauth/app/views/sessions/new.html.erb +15 -0
  33. data/dummy-preauth/app/views/users/_form.html.erb +20 -0
  34. data/dummy-preauth/app/views/users/edit.html.erb +3 -0
  35. data/dummy-preauth/app/views/users/new.html.erb +5 -0
  36. data/dummy-preauth/app/views/welcome/index.html.erb +2 -0
  37. data/dummy-preauth/bin/bundle +3 -0
  38. data/dummy-preauth/bin/rails +4 -0
  39. data/dummy-preauth/bin/rake +4 -0
  40. data/dummy-preauth/config.ru +4 -0
  41. data/dummy-preauth/config/application.rb +22 -0
  42. data/dummy-preauth/config/boot.rb +4 -0
  43. data/dummy-preauth/config/database.yml +25 -0
  44. data/dummy-preauth/config/environment.rb +5 -0
  45. data/dummy-preauth/config/environments/development.rb +27 -0
  46. data/dummy-preauth/config/environments/production.rb +80 -0
  47. data/dummy-preauth/config/environments/test.rb +36 -0
  48. data/dummy-preauth/config/initializers/backtrace_silencers.rb +7 -0
  49. data/dummy-preauth/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/dummy-preauth/config/initializers/inflections.rb +16 -0
  51. data/dummy-preauth/config/initializers/mime_types.rb +5 -0
  52. data/dummy-preauth/config/initializers/omniauth.rb +9 -0
  53. data/dummy-preauth/config/initializers/secret_token.rb +12 -0
  54. data/dummy-preauth/config/initializers/session_store.rb +3 -0
  55. data/dummy-preauth/config/initializers/wrap_parameters.rb +14 -0
  56. data/dummy-preauth/config/locales/en.yml +23 -0
  57. data/dummy-preauth/config/routes.rb +57 -0
  58. data/dummy-preauth/db/migrate/20130423011519_create_users.rb +15 -0
  59. data/dummy-preauth/db/migrate/20130423011738_add_uuid_to_users.rb +5 -0
  60. data/dummy-preauth/db/schema.rb +26 -0
  61. data/dummy-preauth/db/seeds.rb +7 -0
  62. data/{dummy/log/.gitkeep → dummy-preauth/lib/assets/.keep} +0 -0
  63. data/dummy-preauth/lib/controller_authentication.rb +48 -0
  64. data/{dummy/test/fixtures/.gitkeep → dummy-preauth/lib/tasks/.keep} +0 -0
  65. data/{dummy/test/functional/.gitkeep → dummy-preauth/log/.keep} +0 -0
  66. data/dummy-preauth/public/404.html +27 -0
  67. data/dummy-preauth/public/422.html +26 -0
  68. data/dummy-preauth/public/500.html +26 -0
  69. data/{dummy/test/integration/.gitkeep → dummy-preauth/public/favicon.ico} +0 -0
  70. data/dummy-preauth/public/robots.txt +5 -0
  71. data/{dummy/test/unit/.gitkeep → dummy-preauth/test/controllers/.keep} +0 -0
  72. data/dummy-preauth/test/controllers/welcome_controller_test.rb +9 -0
  73. data/{dummy/vendor/assets/javascripts/.gitkeep → dummy-preauth/test/fixtures/.keep} +0 -0
  74. data/dummy-preauth/test/fixtures/users.yml +12 -0
  75. data/dummy-preauth/test/functional/sessions_controller_test.rb +22 -0
  76. data/dummy-preauth/test/functional/users_controller_test.rb +51 -0
  77. data/{dummy/vendor/assets/stylesheets/.gitkeep → dummy-preauth/test/helpers/.keep} +0 -0
  78. data/dummy-preauth/test/helpers/welcome_helper_test.rb +4 -0
  79. data/{dummy/vendor/plugins/.gitkeep → dummy-preauth/test/integration/.keep} +0 -0
  80. data/dummy-preauth/test/mailers/.keep +0 -0
  81. data/dummy-preauth/test/models/.keep +0 -0
  82. data/dummy-preauth/test/test_helper.rb +15 -0
  83. data/dummy-preauth/test/unit/user_test.rb +86 -0
  84. data/dummy-preauth/vendor/assets/javascripts/.keep +0 -0
  85. data/dummy-preauth/vendor/assets/stylesheets/.keep +0 -0
  86. data/dummy/.gitignore +3 -2
  87. data/dummy/Gemfile +14 -28
  88. data/dummy/README.rdoc +15 -248
  89. data/dummy/Rakefile +0 -1
  90. data/dummy/app/assets/javascripts/application.js +2 -1
  91. data/dummy/app/controllers/application_controller.rb +5 -4
  92. data/dummy/app/controllers/concerns/.keep +0 -0
  93. data/dummy/app/mailers/.keep +0 -0
  94. data/dummy/app/models/.keep +0 -0
  95. data/dummy/app/models/concerns/.keep +0 -0
  96. data/dummy/app/views/layouts/application.html.erb +2 -6
  97. data/dummy/bin/bundle +3 -0
  98. data/dummy/bin/rails +4 -0
  99. data/dummy/bin/rake +4 -0
  100. data/dummy/config/application.rb +2 -42
  101. data/dummy/config/boot.rb +0 -2
  102. data/dummy/config/environment.rb +2 -2
  103. data/dummy/config/environments/development.rb +9 -19
  104. data/dummy/config/environments/production.rb +40 -27
  105. data/dummy/config/environments/test.rb +12 -13
  106. data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  107. data/dummy/config/initializers/inflections.rb +6 -5
  108. data/dummy/config/initializers/omniauth.rb +9 -2
  109. data/dummy/config/initializers/secret_token.rb +6 -1
  110. data/dummy/config/initializers/session_store.rb +1 -6
  111. data/dummy/config/initializers/wrap_parameters.rb +6 -6
  112. data/dummy/config/locales/en.yml +20 -2
  113. data/dummy/config/routes.rb +15 -26
  114. data/dummy/db/migrate/{20120925172903_create_users.rb → 20130417131939_create_users.rb} +7 -11
  115. data/dummy/db/schema.rb +9 -19
  116. data/dummy/lib/assets/.keep +0 -0
  117. data/dummy/lib/tasks/.keep +0 -0
  118. data/dummy/log/.keep +0 -0
  119. data/dummy/public/404.html +2 -1
  120. data/dummy/public/422.html +1 -1
  121. data/dummy/public/500.html +2 -1
  122. data/dummy/public/robots.txt +1 -1
  123. data/dummy/test/controllers/.keep +0 -0
  124. data/dummy/test/fixtures/.keep +0 -0
  125. data/dummy/test/helpers/.keep +0 -0
  126. data/dummy/test/integration/.keep +0 -0
  127. data/dummy/test/mailers/.keep +0 -0
  128. data/dummy/test/models/.keep +0 -0
  129. data/dummy/test/test_helper.rb +11 -58
  130. data/dummy/vendor/assets/javascripts/.keep +0 -0
  131. data/dummy/vendor/assets/stylesheets/.keep +0 -0
  132. data/lib/dailycred.rb +2 -2
  133. data/lib/dailycred/acts_as_dailycred.rb +4 -17
  134. data/lib/dailycred/client.rb +1 -0
  135. data/lib/dailycred/engine.rb +3 -2
  136. data/lib/dailycred/helper.rb +4 -4
  137. data/lib/dailycred/middleware.rb +5 -2
  138. data/lib/dailycred/version.rb +1 -1
  139. data/lib/generators/dailycred_generator.rb +17 -8
  140. data/lib/generators/templates/migration_create_user.rb +3 -9
  141. data/lib/omniauth/strategies/dailycred.rb +2 -0
  142. data/spec/helper_spec.rb +1 -3
  143. data/test/generator_test.rb +4 -3
  144. metadata +103 -52
  145. data/dummy/Guardfile +0 -31
  146. data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
  147. data/dummy/app/controllers/posts_controller.rb +0 -86
  148. data/dummy/app/helpers/posts_helper.rb +0 -2
  149. data/dummy/app/models/post.rb +0 -3
  150. data/dummy/app/views/posts/_form.html.erb +0 -21
  151. data/dummy/app/views/posts/edit.html.erb +0 -6
  152. data/dummy/app/views/posts/index.html.erb +0 -23
  153. data/dummy/app/views/posts/new.html.erb +0 -5
  154. data/dummy/app/views/posts/show.html.erb +0 -10
  155. data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
  156. data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
  157. data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
  158. data/dummy/public/index.html +0 -241
  159. data/dummy/script/rails +0 -6
  160. data/dummy/test/fixtures/posts.yml +0 -7
  161. data/dummy/test/fixtures/users.yml +0 -3
  162. data/dummy/test/functional/posts_controller_test.rb +0 -51
  163. data/dummy/test/performance/browsing_test.rb +0 -12
  164. data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
  165. data/dummy/test/unit/post_test.rb +0 -7
  166. data/dummy/test/unit/user_test.rb +0 -77
  167. 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,7 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- one:
4
- title: MyString
5
-
6
- two:
7
- title: MyString
@@ -1,3 +0,0 @@
1
- basic:
2
- uid: 89c93c0a-5999-4b80-811b-c66a3240651b
3
- email: dummy@dailycred.com
@@ -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,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostsHelperTest < ActionView::TestCase
4
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- 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