semi_static 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3858969d960851aac2a526e58a77c5ea8bf60e90
4
- data.tar.gz: 91ea7acfd26f2b652aff02c3cdd3b7fc0521ff38
3
+ metadata.gz: 22ad4aec347a42f10830a054fcb8041a8bc87a8a
4
+ data.tar.gz: 4ceba7117165aef6d8f34bcd72e194361dd144a9
5
5
  SHA512:
6
- metadata.gz: bbbbf86c4132f478f63ea3022de271eade1d5f0fdee99f462906269e2b8387485b86b4259dc11a4bc46525a063cfec1b879b2fad556352f0973b172651ca7bbe
7
- data.tar.gz: 4facbede2541763b876aec97d9e06cb83a4b877969983763e89664ffaaa8373eed04171e4fb70c537adee14c3a0ec8e1e6a2162682908446dfbd595b6449c2d8
6
+ metadata.gz: faf505ca278d1980efacac781c4703bf47e1857288cdbe743d0ad95fd21cd0395807279317e1494b143360ac171902af25491c87f6dac9da34fa3f9c39b301a8
7
+ data.tar.gz: 965c9e62c788f9ca5c7132f9f0f0a9a6c8ce9021882972bec400358e318facf28f8addf742db9e2c18c4582546282e4f1094d13594d274c9743b31017dbe5281
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.7.2
4
+
5
+ - Fix bug when redirecting to an article because the param doesn't match under a scoped route
6
+
3
7
  ## v0.7.1
4
8
 
5
9
  - Use request.env to avoid deprecation warning under Rails 5.
@@ -12,7 +12,7 @@ module SemiStatic::Controller::Page
12
12
  raise ActionController::RoutingError.new(url_for(:id => params[:id], :only_path => true))
13
13
  end
14
14
  unless params[:id] == @article.to_param
15
- redirect_to @article, :status => :moved_permanently
15
+ redirect_to({id: @article}, status: :moved_permanently)
16
16
  end
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module SemiStatic
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -12,8 +12,20 @@ feature 'custom controllers', type: :feature do
12
12
  expect(find("h1").text).to eq("チェックイン端末とはなんですか?")
13
13
  end
14
14
 
15
+ scenario "partial match redirects" do
16
+ visit faq_path("チェックイン端末")
17
+ expect(page.current_path).to eq(faq_path("チェックイン端末とはなんですか"))
18
+ expect(find("h1").text).to eq("チェックイン端末とはなんですか?")
19
+ end
20
+
15
21
  scenario "namespaced controller" do
16
22
  visit admin_faqs_path
17
23
  expect(find("body").text).to eq("Namespaced")
18
24
  end
25
+
26
+ scenario "namespaced controller redirects" do
27
+ visit admin_faq_path("チェックイン端末")
28
+ expect(page.current_path).to eq(admin_faq_path("チェックイン端末とはなんですか"))
29
+ expect(find("h1").text).to eq("チェックイン端末とはなんですか?")
30
+ end
19
31
  end
@@ -1,3 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  class Faq < SemiStatic::Page
3
+ def self.find(param)
4
+ all.find {|a| a.to_param.match(/^#{Regexp.escape(param)}/)}
5
+ end
3
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semi_static
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul McMahon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails