Permalink
Browse files

Add on_app_created callback

  • Loading branch information...
1 parent 68b24eb commit 8ec788bca1182fec6eba3f5fce925b41d2624d66 Jesse Stuart committed Oct 5, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 lib/omniauth/strategies/tent.rb
  2. +1 −1 spec/omniauth/strategies/tent_spec.rb
View
2 lib/omniauth/strategies/tent.rb
@@ -15,6 +15,7 @@ class Tent
StateMissmatchError = Class.new(Error)
option :get_app, lambda { |entity| }
+ option :on_app_created, lambda { |app| }
option :app, { :name => nil, :icon => nil, :description => nil, :scopes => {}, :redirect_uris => nil }
option :profile_info_types, []
option :post_types, []
@@ -129,6 +130,7 @@ def create_app
if (app = res.body) && !app.kind_of?(::String)
set_app(app)
+ options[:on_app_created].call(get_app)
else
raise AppCreateFailure.new(res.inspect)
end
View
2 spec/omniauth/strategies/tent_spec.rb
@@ -108,7 +108,7 @@ def set_app!(tent_options = {})
end
it 'should create app if not found' do
- set_app!(:app => app_attrs)
+ set_app!(:app => app_attrs, :on_app_created => mock(:call))
stub_head_discovery!
stub_profile_discovery!
stub_app_lookup_failure!

0 comments on commit 8ec788b

Please sign in to comment.