kuhsaft 2.0.1 → 2.0.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: 1888dcf05a0ec09cdbc8e11da4342dc2ad852ed3
4
- data.tar.gz: e5fe636466e862043f38105120251d592b132718
3
+ metadata.gz: eecde1b2e276afa2b521baaf04bd0312a4ec74d9
4
+ data.tar.gz: 257ed6496e7b45df88df4f8d556875164eef0013
5
5
  SHA512:
6
- metadata.gz: 6306a8ffd5e2802eee8ad4629e591c52579be272b2ad84c58a5d63ec868a17843c7f0cd20014df551b47323e3c67ea5f33ff5977f42594098b2c28f6b06d2585
7
- data.tar.gz: 16885f03b3401ba983a1f26573435722508f47b7b7f819ca6c61ffa34ae65065d0630b75a71f46b0097a55b340b2b282f15eee38eecdcf19e1277358734a2cf5
6
+ metadata.gz: 8ed475ede79f506ecfb728f9eefa525e9116f2cb956949cbf661ff13dd3953fa957e4285e38e44868a7acec6934ce2bec7c64f046f5613eaac217c3ca52ace7c
7
+ data.tar.gz: 131744bc047b4d30e1626f4c69b90d4f3c221f1f9ce6488ba59db4ad0371873676edf54c6d734ee18c3f4c5fc8b26ccc650754636d581fbad4f2b4bbd6a867b9
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ rescue LoadError
12
12
  end
13
13
 
14
14
  desc "Run specs"
15
- RSpec::Core::RakeTask.new
15
+ RSpec::Core::RakeTask.new(:spec => :setup)
16
16
 
17
17
  RDoc::Task.new(:rdoc) do |rdoc|
18
18
  rdoc.rdoc_dir = 'rdoc'
@@ -24,6 +24,8 @@ end
24
24
 
25
25
  task :setup do
26
26
  Dir.chdir('spec/dummy') do
27
+ `bundle exec rake kuhsaft:install:migrations`
28
+ `bundle exec rails generate kuhsaft:install:assets`
27
29
  `bundle exec rake db:create`
28
30
  `bundle exec rake db:migrate`
29
31
  `bundle exec rake db:test:prepare`
@@ -5,10 +5,6 @@ module Kuhsaft
5
5
  layout 'kuhsaft/cms/application'
6
6
  before_filter :set_content_locale
7
7
 
8
- def url_options
9
- { content_locale: I18n.locale }.merge(super)
10
- end
11
-
12
8
  def set_content_locale
13
9
  if params[:content_locale].present?
14
10
  I18n.locale = params[:content_locale]
@@ -15,7 +15,8 @@ module Kuhsaft
15
15
  @page = Kuhsaft::Page.find_by_url(url)
16
16
 
17
17
  if @page.present? && @page.redirect? && @page.redirect_url.present?
18
- redirect_to "/#{@page.redirect_url}"
18
+ redirect_url = @page.redirect_url.sub(/\A\/+/,'') # remove all preceding slashes
19
+ redirect_to "/#{redirect_url}"
19
20
  elsif @page.present?
20
21
  respond_with @page
21
22
  elsif @page.blank? && respond_to?(:handle_404)
@@ -3,7 +3,6 @@
3
3
  - pages.each do |page|
4
4
  %li.dd-item.dd3-item{ 'data-id' => page.id }
5
5
  .dd-handle.dd3-handle
6
- handle
7
6
  .dd3-content{ class: page.state_class }
8
7
  = link_to page.title.presence, kuhsaft.edit_cms_page_path(page)
9
8
 
@@ -5,6 +5,9 @@ de:
5
5
  admin:
6
6
  pages_nav: 'Seiten'
7
7
  assets_nav: 'Assets'
8
+ cms:
9
+ flash:
10
+ success: 'Seite wurde erfolgreich aktualisiert'
8
11
  kuhsaft:
9
12
  page_part:
10
13
  markdown: 'Formatierter Text'
@@ -44,4 +47,4 @@ de:
44
47
  title: 'Seiten Titel'
45
48
  slug: 'URL Segment'
46
49
  page_part_type: 'Element hinzufügen'
47
- _destroy: 'Diese Element löschen'
50
+ _destroy: 'Diese Element löschen'
@@ -5,6 +5,9 @@ en:
5
5
  admin:
6
6
  pages_nav: 'Pages'
7
7
  assets_nav: 'Assets'
8
+ cms:
9
+ flash:
10
+ success: 'Page was updated successfully'
8
11
  kuhsaft:
9
12
  page_part:
10
13
  markdown: 'Formatted Text'
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -22,30 +22,6 @@ describe Kuhsaft::PagesController do
22
22
  end
23
23
 
24
24
  describe '#show' do
25
- describe 'redirect' do
26
- around(:each) do |example|
27
- I18n.with_locale :de do
28
- example.run
29
- end
30
- end
31
-
32
- context 'when page is not a redirect page' do
33
- it 'responds with page' do
34
- page = FactoryGirl.create(:page, :slug => 'dumdidum', :url => 'de/dumdidum')
35
- get :show, { :url => page.slug, :use_route => :kuhsaft }
36
- assigns(:page).should eq(page)
37
- end
38
- end
39
-
40
- context 'when page is a redirect page' do
41
- it 'redirects to the redirected url' do
42
- page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => 'de/redirect_page')
43
- get :show, { :url => page.slug, :use_route => :kuhsaft }
44
- expect(response).to redirect_to("/de/redirect_page")
45
- end
46
- end
47
- end
48
-
49
25
  describe 'routing' do
50
26
  context 'without url' do
51
27
  before do
@@ -90,7 +66,19 @@ describe Kuhsaft::PagesController do
90
66
  it 'redirects to the redirected url' do
91
67
  page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => 'de/redirect_page')
92
68
  get :show, { :url => page.slug, :use_route => :kuhsaft }
93
- expect(response).to redirect_to("/de/redirect_page")
69
+ expect(response).to redirect_to('/de/redirect_page')
70
+ end
71
+
72
+ it 'redirects to invalid redirect urls with too many preceding slashes' do
73
+ page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => '///de/redirect_page')
74
+ get :show, { :url => page.slug, :use_route => :kuhsaft }
75
+ expect(response).to redirect_to('/de/redirect_page')
76
+ end
77
+
78
+ it 'redirects to root' do
79
+ page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => '/')
80
+ get :show, { :url => page.slug, :use_route => :kuhsaft }
81
+ expect(response).to redirect_to('/')
94
82
  end
95
83
  end
96
84
  end
@@ -35,18 +35,8 @@ RSpec.configure do |config|
35
35
  config.include FactoryGirl::Syntax::Methods
36
36
 
37
37
  config.before :suite do
38
-
39
- load File.expand_path("../dummy/Rakefile", __FILE__)
40
- Dir.chdir(File.join(File.dirname(__FILE__), './dummy')) do
41
- Rake::Task['kuhsaft:install:migrations'].invoke
42
- Rails::Generators.invoke('kuhsaft:install:assets')
43
- end
44
-
45
38
  DatabaseCleaner.strategy = :transaction
46
39
  DatabaseCleaner.clean_with(:truncation)
47
- # Drop all records and run any available migration
48
- ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
49
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
50
40
  end
51
41
 
52
42
  config.after :suite do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immanuel Häussermann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-07-16 00:00:00.000000000 Z
15
+ date: 2013-07-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec