radiant-templates-extension 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HELP_designer.textile +3 -3
- data/README.textile +3 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/views/admin/pages/_edit_template.html.haml +1 -2
- data/app/views/admin/pages/_switch_templates.html.haml +4 -4
- data/app/views/admin/pages/_template_chooser.html.haml +43 -0
- data/app/views/admin/templates/index.html.haml +0 -1
- data/pkg/radiant-templates-extension-1.0.0.gem +0 -0
- data/radiant-templates-extension.gemspec +176 -0
- data/templates_extension.rb +1 -1
- data/vendor/plugins/make_resourceful/.gitignore +1 -0
- data/vendor/plugins/make_resourceful/DEFAULTS +1 -1
- data/vendor/plugins/make_resourceful/README +7 -6
- data/vendor/plugins/make_resourceful/Rakefile +2 -13
- data/vendor/plugins/make_resourceful/VERSION +1 -1
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +1 -8
- data/vendor/plugins/make_resourceful/lib/resourceful/base.rb +11 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/builder.rb +33 -2
- data/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb +63 -7
- data/vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb +15 -6
- data/vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb +7 -7
- data/vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb +6 -6
- data/vendor/plugins/make_resourceful/lib/resourceful/maker.rb +1 -0
- data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +3 -2
- data/vendor/plugins/make_resourceful/spec/actions_spec.rb +33 -6
- data/vendor/plugins/make_resourceful/spec/integration_spec.rb +22 -22
- data/vendor/plugins/make_resourceful/spec/{rspec_on_rails → rspec-rails}/LICENSE +8 -6
- data/vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb +113 -0
- data/vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb +90 -0
- data/vendor/plugins/make_resourceful/spec/spec_helper.rb +62 -22
- data/vendor/plugins/make_resourceful/spec/urls_spec.rb +2 -0
- metadata +15 -11
- data/vendor/plugins/make_resourceful/spec/rspec_on_rails/redirect_to.rb +0 -81
- data/vendor/plugins/make_resourceful/spec/rspec_on_rails/render_template.rb +0 -28
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'action_controller/url_rewriter'
|
2
|
-
|
3
|
-
class RedirectTo
|
4
|
-
def initialize(request, expected)
|
5
|
-
@expected = expected
|
6
|
-
@request = request
|
7
|
-
end
|
8
|
-
|
9
|
-
def matches?(response)
|
10
|
-
@redirected = response.redirect?
|
11
|
-
@actual = response.redirect_url
|
12
|
-
return false unless @redirected
|
13
|
-
if @expected.instance_of? Hash
|
14
|
-
return false unless @actual =~ %r{^\w+://#{@request.host}}
|
15
|
-
return false unless actual_redirect_to_valid_route
|
16
|
-
return actual_hash == expected_hash
|
17
|
-
else
|
18
|
-
return @actual == expected_url
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def actual_hash
|
23
|
-
hash_from_url @actual
|
24
|
-
end
|
25
|
-
|
26
|
-
def expected_hash
|
27
|
-
hash_from_url expected_url
|
28
|
-
end
|
29
|
-
|
30
|
-
def actual_redirect_to_valid_route
|
31
|
-
actual_hash
|
32
|
-
end
|
33
|
-
|
34
|
-
def hash_from_url(url)
|
35
|
-
query_hash(url).merge(path_hash(url)).with_indifferent_access
|
36
|
-
end
|
37
|
-
|
38
|
-
def path_hash(url)
|
39
|
-
path = url.sub(%r{^\w+://#{@request.host}}, "").split("?", 2)[0]
|
40
|
-
path = path.split("/")[1..-1] if ::Rails::VERSION::MINOR < 2
|
41
|
-
ActionController::Routing::Routes.recognize_path path
|
42
|
-
end
|
43
|
-
|
44
|
-
def query_hash(url)
|
45
|
-
query = url.split("?", 2)[1] || ""
|
46
|
-
if defined?(CGIMethods)
|
47
|
-
CGIMethods.parse_query_parameters(query)
|
48
|
-
else
|
49
|
-
ActionController::AbstractRequest.parse_query_parameters(query)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def expected_url
|
54
|
-
case @expected
|
55
|
-
when Hash
|
56
|
-
return ActionController::UrlRewriter.new(@request, {}).rewrite(@expected)
|
57
|
-
when :back
|
58
|
-
return @request.env['HTTP_REFERER']
|
59
|
-
when %r{^\w+://.*}
|
60
|
-
return @expected
|
61
|
-
else
|
62
|
-
return "http://#{@request.host}" + (@expected.split('')[0] == '/' ? '' : '/') + @expected
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def failure_message
|
67
|
-
if @redirected
|
68
|
-
return %Q{expected redirect to #{@expected.inspect}, got redirect to #{@actual.inspect}}
|
69
|
-
else
|
70
|
-
return %Q{expected redirect to #{@expected.inspect}, got no redirect}
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def negative_failure_message
|
75
|
-
return %Q{expected not to be redirected to #{@expected.inspect}, but was} if @redirected
|
76
|
-
end
|
77
|
-
|
78
|
-
def description
|
79
|
-
"redirect to #{@actual.inspect}"
|
80
|
-
end
|
81
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
class RenderTemplate
|
3
|
-
|
4
|
-
def initialize(expected, controller)
|
5
|
-
@controller = controller
|
6
|
-
@expected = expected
|
7
|
-
end
|
8
|
-
|
9
|
-
def matches?(response)
|
10
|
-
@actual = response.rendered_file
|
11
|
-
full_path(@actual) == full_path(@expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
def failure_message
|
15
|
-
"expected #{@expected.inspect}, got #{@actual.inspect}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def description
|
19
|
-
"render template #{@expected.inspect}"
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
def full_path(path)
|
24
|
-
return nil if path.nil?
|
25
|
-
path.include?('/') ? path : "#{@controller.class.to_s.underscore.gsub('_controller','')}/#{path}"
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|