-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of testing for zero-configness
- Loading branch information
1 parent
1811684
commit 41e69e7
Showing
7 changed files
with
153 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
require 'intercom-rails/railtie' if defined? Rails | ||
require 'intercom-rails/script_tag_helper' | ||
require 'intercom-rails/action_controller_patch' | ||
require 'intercom-rails/railtie' if defined? Rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'intercom-rails' | ||
|
||
require 'minitest/autorun' | ||
require 'action_controller' | ||
require 'action_controller/test_case' | ||
|
||
def dummy_user | ||
user = Struct.new(:email, :name).new | ||
user.email = 'ben@intercom.io' | ||
user.name = 'Ben McRedmond' | ||
user | ||
end | ||
|
||
TestRoutes = ActionDispatch::Routing::RouteSet.new | ||
TestRoutes.draw do | ||
get ':controller(/:action)' | ||
end | ||
|
||
|
||
class ActionController::Base | ||
|
||
include TestRoutes.url_helpers | ||
include TestRoutes.mounted_helpers | ||
|
||
end | ||
|
||
class ActionController::TestCase | ||
|
||
def setup | ||
super | ||
@routes = TestRoutes | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'action_controller_test_setup' | ||
|
||
class TestController < ActionController::Base | ||
|
||
#include IntercomRails::ActionControllerPatch | ||
|
||
#def not_logged_in | ||
#end | ||
|
||
def logged_in | ||
@user = dummy_user | ||
render :text => "Hello world", :content_type => 'text/html' | ||
end | ||
|
||
end | ||
|
||
|
||
class ActionControllerPatchTest < ActionController::TestCase | ||
|
||
tests TestController | ||
|
||
def test_user_present_response | ||
get :logged_in | ||
assert_equal "Hello world", @response.body | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters