mascot-rails 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+
3
+ describe Mascot::Extensions::PartialsRemover do
4
+ context ".partial?" do
5
+ it "is true if begins with _" do
6
+ expect(Mascot::Extensions::PartialsRemover.partial?("/foo.bar/_buzz.haml")).to be true
7
+ end
8
+ it "is false if does not being with _" do
9
+ expect(Mascot::Extensions::PartialsRemover.partial?("/foo.bar/buzz.haml")).to be false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require "spec_helper"
2
+
3
+ describe Mascot::Extensions::RailsRequestPaths do
4
+ context ".format_path" do
5
+ it "converts /foo.bar/buzz.html to /foo.bar/buzz" do
6
+ expect(Mascot::Extensions::RailsRequestPaths.format_path("/foo.bar/buzz"))
7
+ end
8
+ end
9
+ end
@@ -1,11 +1,18 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Mascot::RailsConfiguration do
4
- subject { Mascot.configuration }
5
- let(:sitemap) { Mascot.configuration.sitemap }
6
- context "resouces" do
7
- it "excludes partials" do
8
- expect(subject.resources.size).to eql(sitemap.resources.size - 1)
4
+ subject { Mascot::RailsConfiguration.new }
5
+ context "#partials" do
6
+ it "excludes by default" do
7
+ expect(subject.partials).to be false
8
+ end
9
+ it "excludes partials if false" do
10
+ subject.partials = false
11
+ expect(subject.resources.size).to eql(2)
12
+ end
13
+ it "includes partials if true" do
14
+ subject.partials = true
15
+ expect(subject.resources.size).to eql(3)
9
16
  end
10
17
  end
11
18
  end
@@ -1,17 +1,16 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Mascot::RouteConstraint do
4
- let(:sitemap) { Mascot::Sitemap.new(root: "spec/pages") }
5
- let(:route_constraint) { Mascot::RouteConstraint.new(sitemap) }
4
+ let(:subject) { Mascot::RouteConstraint.new }
6
5
 
7
6
  context "#matches?" do
8
7
  it "returns true if match" do
9
- request = double("request", path: "/test")
10
- expect(route_constraint.matches?(request)).to be(true)
8
+ request = double("request", path: "/time")
9
+ expect(subject.matches?(request)).to be(true)
11
10
  end
12
11
  it "returns false if not match" do
13
12
  request = double("request", path: "/does-not-exist")
14
- expect(route_constraint.matches?(request)).to be(false)
13
+ expect(subject.matches?(request)).to be(false)
15
14
  end
16
15
  end
17
16
  end
data/spec/spec_helper.rb CHANGED
@@ -16,7 +16,7 @@ RSpec.configure do |config|
16
16
  config.infer_base_class_for_anonymous_controllers = false
17
17
  config.order = "random"
18
18
  config.after(:each) do
19
- Mascot.instance_variable_set(:@configuration, nil)
19
+ Mascot.reset_configuration
20
20
  Rails.application.reload_routes!
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mascot-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.7
61
+ version: 0.1.8
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.7
68
+ version: 0.1.8
69
69
  description:
70
70
  email:
71
71
  - bradgessler@gmail.com
@@ -81,6 +81,8 @@ files:
81
81
  - lib/mascot-rails.rb
82
82
  - lib/mascot/action_controller_context.rb
83
83
  - lib/mascot/engine.rb
84
+ - lib/mascot/extensions/partials_remover.rb
85
+ - lib/mascot/extensions/rails_request_paths.rb
84
86
  - lib/mascot/rails.rb
85
87
  - lib/mascot/rails_configuration.rb
86
88
  - lib/mascot/route_constraint.rb
@@ -145,6 +147,8 @@ files:
145
147
  - spec/dummy/public/favicon.ico
146
148
  - spec/mascot-rails_spec.rb
147
149
  - spec/mascot/action_controller_context_spec.rb
150
+ - spec/mascot/extensions/partials_remover_spec.rb
151
+ - spec/mascot/extensions/rails_request_paths_spec.rb
148
152
  - spec/mascot/mascot_sitemap_controller_spec.rb
149
153
  - spec/mascot/rails_configuration_spec.rb
150
154
  - spec/mascot/route_constraint_spec.rb
@@ -237,6 +241,8 @@ test_files:
237
241
  - spec/dummy/public/favicon.ico
238
242
  - spec/dummy/Rakefile
239
243
  - spec/mascot/action_controller_context_spec.rb
244
+ - spec/mascot/extensions/partials_remover_spec.rb
245
+ - spec/mascot/extensions/rails_request_paths_spec.rb
240
246
  - spec/mascot/mascot_sitemap_controller_spec.rb
241
247
  - spec/mascot/rails_configuration_spec.rb
242
248
  - spec/mascot/route_constraint_spec.rb