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
@@ -0,0 +1,85 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{subdomain_routes}
8
+ s.version = "0.3.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Matthew Hollingworth"]
12
+ s.date = %q{2009-10-10}
13
+ s.description = %q{ SubdomainRoutes add subdomain conditions to the Rails routing system. Routes may be restricted to
14
+ one or many specified subdomains. An URL will be recognised only if the host subdomain matches the
15
+ subdomain specified in the route. Route generation is also enhanced, so that the subdomain of a
16
+ generated URL (or path) will be changed if the requested route has a different subdomain to that of
17
+ the current request. Model-based subdomain routes can also be defined.
18
+ }
19
+ s.email = %q{mdholling@gmail.com}
20
+ s.extra_rdoc_files = [
21
+ "LICENSE",
22
+ "README.textile"
23
+ ]
24
+ s.files = [
25
+ ".document",
26
+ ".gitignore",
27
+ "LICENSE",
28
+ "README.textile",
29
+ "Rakefile",
30
+ "VERSION.yml",
31
+ "history.txt",
32
+ "lib/subdomain_routes.rb",
33
+ "lib/subdomain_routes/assertions.rb",
34
+ "lib/subdomain_routes/config.rb",
35
+ "lib/subdomain_routes/mapper.rb",
36
+ "lib/subdomain_routes/request.rb",
37
+ "lib/subdomain_routes/resources.rb",
38
+ "lib/subdomain_routes/routes.rb",
39
+ "lib/subdomain_routes/split_host.rb",
40
+ "lib/subdomain_routes/url_writer.rb",
41
+ "lib/subdomain_routes/validations.rb",
42
+ "rails/init.rb",
43
+ "spec/assertions_spec.rb",
44
+ "spec/extraction_spec.rb",
45
+ "spec/mapping_spec.rb",
46
+ "spec/recognition_spec.rb",
47
+ "spec/resources_spec.rb",
48
+ "spec/routes_spec.rb",
49
+ "spec/spec_helper.rb",
50
+ "spec/test_unit_matcher.rb",
51
+ "spec/url_writing_spec.rb",
52
+ "spec/validations_spec.rb",
53
+ "subdomain_routes.gemspec"
54
+ ]
55
+ s.homepage = %q{http://github.com/mholling/subdomain_routes}
56
+ s.rdoc_options = ["--charset=UTF-8"]
57
+ s.require_paths = ["lib"]
58
+ s.rubygems_version = %q{1.3.5}
59
+ s.summary = %q{A Rails library for incorporating subdomains into route generation and recognition.}
60
+ s.test_files = [
61
+ "spec/assertions_spec.rb",
62
+ "spec/extraction_spec.rb",
63
+ "spec/mapping_spec.rb",
64
+ "spec/recognition_spec.rb",
65
+ "spec/resources_spec.rb",
66
+ "spec/routes_spec.rb",
67
+ "spec/spec_helper.rb",
68
+ "spec/test_unit_matcher.rb",
69
+ "spec/url_writing_spec.rb",
70
+ "spec/validations_spec.rb"
71
+ ]
72
+
73
+ if s.respond_to? :specification_version then
74
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
+ s.specification_version = 3
76
+
77
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
78
+ s.add_runtime_dependency(%q<actionpack>, [">= 2.2.1"])
79
+ else
80
+ s.add_dependency(%q<actionpack>, [">= 2.2.1"])
81
+ end
82
+ else
83
+ s.add_dependency(%q<actionpack>, [">= 2.2.1"])
84
+ end
85
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: subdomain_routes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Hollingworth
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-10 00:00:00 +11:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: actionpack
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.1
24
+ version:
25
+ 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"
26
+ email: mdholling@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.textile
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.textile
39
+ - Rakefile
40
+ - VERSION.yml
41
+ - history.txt
42
+ - lib/subdomain_routes.rb
43
+ - lib/subdomain_routes/assertions.rb
44
+ - lib/subdomain_routes/config.rb
45
+ - lib/subdomain_routes/mapper.rb
46
+ - lib/subdomain_routes/request.rb
47
+ - lib/subdomain_routes/resources.rb
48
+ - lib/subdomain_routes/routes.rb
49
+ - lib/subdomain_routes/split_host.rb
50
+ - lib/subdomain_routes/url_writer.rb
51
+ - lib/subdomain_routes/validations.rb
52
+ - rails/init.rb
53
+ - spec/assertions_spec.rb
54
+ - spec/extraction_spec.rb
55
+ - spec/mapping_spec.rb
56
+ - spec/recognition_spec.rb
57
+ - spec/resources_spec.rb
58
+ - spec/routes_spec.rb
59
+ - spec/spec_helper.rb
60
+ - spec/test_unit_matcher.rb
61
+ - spec/url_writing_spec.rb
62
+ - spec/validations_spec.rb
63
+ - subdomain_routes.gemspec
64
+ has_rdoc: true
65
+ homepage: http://github.com/mholling/subdomain_routes
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --charset=UTF-8
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.3.5
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: A Rails library for incorporating subdomains into route generation and recognition.
92
+ test_files:
93
+ - spec/assertions_spec.rb
94
+ - spec/extraction_spec.rb
95
+ - spec/mapping_spec.rb
96
+ - spec/recognition_spec.rb
97
+ - spec/resources_spec.rb
98
+ - spec/routes_spec.rb
99
+ - spec/spec_helper.rb
100
+ - spec/test_unit_matcher.rb
101
+ - spec/url_writing_spec.rb
102
+ - spec/validations_spec.rb