trails 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.txt +1 -1
- data/lib/trails.rb +1 -1
- data/lib/trails/twilio/call_handling.rb +12 -0
- data/test/example/test/test_helper.rb +38 -0
- data/test/test_trails.rb +3 -0
- metadata +4 -3
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Code to make developing twilio applications (even) easier in rails.
|
8
8
|
|
9
|
-
Includes support for a special MimeType? (twiml), and functional tests: as_twilio{ get '/my_action' }
|
9
|
+
Includes support for SMS, a special MimeType? (twiml), and functional tests: as_twilio{ get '/my_action' }
|
10
10
|
|
11
11
|
|
12
12
|
== FEATURES/PROBLEMS:
|
data/lib/trails.rb
CHANGED
@@ -8,10 +8,21 @@ module Trails
|
|
8
8
|
klass.send( :before_filter, :setup_incoming_call )
|
9
9
|
klass.send( :attr_reader, :incoming_call )
|
10
10
|
klass.send( :alias_method_chain, :protect_against_forgery?, :twilio )
|
11
|
+
klass.send( :append_view_path, File.expand_path( File.join( File.dirname( __FILE__ ),
|
12
|
+
'../../../assets' ) ) )
|
13
|
+
klass.send( :alias_method_chain, :default_layout, :twilio )
|
11
14
|
end
|
12
15
|
|
13
16
|
protected
|
14
17
|
|
18
|
+
def default_layout_with_twilio
|
19
|
+
is_twilio_call? ? twiml_layout : default_layout_without_twilio
|
20
|
+
end
|
21
|
+
|
22
|
+
def twiml_layout
|
23
|
+
'default_layout.twiml.builder'
|
24
|
+
end
|
25
|
+
|
15
26
|
def protect_against_forgery_with_twilio?
|
16
27
|
is_twilio_call? ? false : protect_against_forgery_without_twilio?
|
17
28
|
end
|
@@ -21,6 +32,7 @@ module Trails
|
|
21
32
|
logger.debug( "at the beginning, request.params = #{request.parameters}" )
|
22
33
|
request.format = :twiml
|
23
34
|
response.content_type = 'text/xml'
|
35
|
+
|
24
36
|
@incoming_call = Trails::Twilio::Incoming.new( request )
|
25
37
|
end
|
26
38
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
#
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
22
|
+
self.use_transactional_fixtures = true
|
23
|
+
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
28
|
+
# then set this back to true.
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
+
#
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
+
# -- they do not yet inherit this setting
|
35
|
+
fixtures :all
|
36
|
+
|
37
|
+
# Add more helper methods to be used by all tests here...
|
38
|
+
end
|
data/test/test_trails.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hemant Bhanoo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
description: |-
|
46
46
|
Code to make developing twilio applications (even) easier in rails.
|
47
47
|
|
48
|
-
Includes support for a special MimeType? (twiml), and functional tests: as_twilio{ get '/my_action' }
|
48
|
+
Includes support for SMS, a special MimeType? (twiml), and functional tests: as_twilio{ get '/my_action' }
|
49
49
|
email:
|
50
50
|
- hemant@bhanoo.com
|
51
51
|
executables: []
|
@@ -98,4 +98,5 @@ signing_key:
|
|
98
98
|
specification_version: 3
|
99
99
|
summary: Code to make developing twilio applications (even) easier in rails
|
100
100
|
test_files:
|
101
|
+
- test/example/test/test_helper.rb
|
101
102
|
- test/test_trails.rb
|