affinitylabs-subdomain_routes 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ describe "ActiveRecord::Base" do
2
+ before(:each) do
3
+ class User < ActiveRecord::Base
4
+ attr_accessor :subdomain
5
+ end
6
+ end
7
+
8
+ it "should have validates_subdomain_format_of which runs SubdomainRoutes.valid_subdomain? against the attributes" do
9
+ User.validates_subdomain_format_of :subdomain
10
+ SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(true)
11
+ User.new(:subdomain => "mholling").should be_valid
12
+ SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(nil)
13
+ User.new(:subdomain => "mholling").should_not be_valid
14
+ end
15
+
16
+ it "should have validates_subdomain_not_reserved which checks the attributes against the fixed-subdomain routes" do
17
+ User.validates_subdomain_not_reserved :subdomain
18
+ reserved = [ "", "www", "support", "admin" ]
19
+ map_subdomain(*reserved) { |map| map.resource :home }
20
+ reserved.each do |subdomain|
21
+ User.new(:subdomain => subdomain).should_not be_valid
22
+ end
23
+ [ "mholling", "edmondst" ].each do |subdomain|
24
+ User.new(:subdomain => subdomain).should be_valid
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: affinitylabs-subdomain_routes
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 1
10
+ version: 0.3.1
11
+ platform: ruby
12
+ authors:
13
+ - Matthew Hollingworth
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-30 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: actionpack
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 2
32
+ - 2
33
+ - 1
34
+ version: 2.2.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: " SubdomainRoutes add subdomain conditions to the Rails routing system. Routes may be restricted to\n one or many specified subdomains. An URL will be recognised only if the host subdomain matches the\n subdomain specified in the route. Route generation is also enhanced, so that the subdomain of a\n generated URL (or path) will be changed if the requested route has a different subdomain to that of\n the current request. Model-based subdomain routes can also be defined.\n"
38
+ email: mdholling@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.textile
46
+ files:
47
+ - .document
48
+ - LICENSE
49
+ - README.textile
50
+ - Rakefile
51
+ - VERSION.yml
52
+ - affinitylabs-subdomain_routes.gemspec
53
+ - history.txt
54
+ - lib/subdomain_routes.rb
55
+ - lib/subdomain_routes/assertions.rb
56
+ - lib/subdomain_routes/config.rb
57
+ - lib/subdomain_routes/mapper.rb
58
+ - lib/subdomain_routes/request.rb
59
+ - lib/subdomain_routes/resources.rb
60
+ - lib/subdomain_routes/routes.rb
61
+ - lib/subdomain_routes/split_host.rb
62
+ - lib/subdomain_routes/url_writer.rb
63
+ - lib/subdomain_routes/validations.rb
64
+ - rails/init.rb
65
+ - spec/assertions_spec.rb
66
+ - spec/extraction_spec.rb
67
+ - spec/mapping_spec.rb
68
+ - spec/recognition_spec.rb
69
+ - spec/resources_spec.rb
70
+ - spec/routes_spec.rb
71
+ - spec/spec_helper.rb
72
+ - spec/test_unit_matcher.rb
73
+ - spec/url_writing_spec.rb
74
+ - spec/validations_spec.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/affinitylabs/subdomain_routes
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options: []
81
+
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project:
105
+ rubygems_version: 1.3.7
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: A Rails library for incorporating subdomains into route generation and recognition.
109
+ test_files: []
110
+