kuhsaft 2.4.3 → 2.5.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +207 -130
  3. data/app/assets/javascripts/kuhsaft/cms/application.js.coffee.erb +14 -12
  4. data/app/controllers/kuhsaft/cms/admin_controller.rb +1 -1
  5. data/app/controllers/kuhsaft/pages_controller.rb +1 -0
  6. data/app/helpers/kuhsaft/cms/admin_helper.rb +51 -0
  7. data/app/helpers/kuhsaft/cms/pages_helper.rb +1 -1
  8. data/app/helpers/pages_helper.rb +4 -0
  9. data/app/models/kuhsaft/page.rb +6 -1
  10. data/app/models/kuhsaft/page_type.rb +2 -1
  11. data/app/views/shoestrap/base/_form.html.haml +9 -0
  12. data/config/routes.rb +1 -1
  13. data/lib/kuhsaft/version.rb +1 -1
  14. data/spec/controllers/kuhsaft/api/pages_controller_spec.rb +1 -1
  15. data/spec/controllers/kuhsaft/pages_controller_spec.rb +4 -4
  16. data/spec/controllers/kuhsaft/sitemaps_controller_spec.rb +1 -1
  17. data/spec/features/cms_pages_spec.rb +5 -5
  18. data/spec/features/search_spec.rb +10 -10
  19. data/spec/helpers/kuhsaft/cms/admin_helper_spec.rb +5 -5
  20. data/spec/helpers/kuhsaft/cms/pages_helper_spec.rb +4 -4
  21. data/spec/helpers/kuhsaft/pages_helper_spec.rb +4 -4
  22. data/spec/kuhsaft_spec.rb +1 -1
  23. data/spec/lib/brick_list_spec.rb +9 -7
  24. data/spec/lib/engine_spec.rb +2 -2
  25. data/spec/lib/gridded_spec.rb +2 -2
  26. data/spec/lib/image_uploader_mounting_spec.rb +1 -1
  27. data/spec/lib/page_tree_spec.rb +2 -2
  28. data/spec/lib/searchable_spec.rb +1 -1
  29. data/spec/lib/translatable_spec.rb +16 -16
  30. data/spec/models/accordion_brick_spec.rb +6 -6
  31. data/spec/models/accordion_item_brick_spec.rb +7 -7
  32. data/spec/models/anchor_brick_spec.rb +4 -4
  33. data/spec/models/asset_brick_spec.rb +7 -7
  34. data/spec/models/asset_spec.rb +6 -6
  35. data/spec/models/brick_spec.rb +22 -22
  36. data/spec/models/brick_type_filter_spec.rb +12 -12
  37. data/spec/models/column_brick_spec.rb +5 -5
  38. data/spec/models/image_brick_spec.rb +8 -8
  39. data/spec/models/image_size_spec.rb +5 -5
  40. data/spec/models/link_brick_spec.rb +8 -8
  41. data/spec/models/page_spec.rb +50 -50
  42. data/spec/models/placeholder_brick_spec.rb +6 -6
  43. data/spec/models/publish_state_spec.rb +4 -4
  44. data/spec/models/slider_brick_spec.rb +4 -4
  45. data/spec/models/text_brick_spec.rb +4 -4
  46. data/spec/models/two_column_brick_spec.rb +13 -13
  47. data/spec/models/video_brick_spec.rb +4 -4
  48. data/spec/support/write_expectation.rb +2 -2
  49. data/spec/views/kuhsaft/sitemaps/index.xml.haml_spec.rb +3 -3
  50. metadata +13 -26
@@ -54,6 +54,11 @@ module Kuhsaft
54
54
  def by_identifier(identifier)
55
55
  where(identifier: identifier).first
56
56
  end
57
+
58
+ def all_urls
59
+ url_columns = column_names.select { |col| col.start_with? 'url_' }
60
+ pluck(url_columns).flatten.compact.sort.uniq.map { |r| "/#{r}" }
61
+ end
57
62
  end
58
63
 
59
64
  def without_self
@@ -69,7 +74,7 @@ module Kuhsaft
69
74
  end
70
75
 
71
76
  def redirect?
72
- page_type == Kuhsaft::PageType::REDIRECT
77
+ page_type == Kuhsaft::PageType::REDIRECT || page_type == Kuhsaft::PageType::CUSTOM
73
78
  end
74
79
 
75
80
  def navigation?
@@ -3,9 +3,10 @@ module Kuhsaft
3
3
  REDIRECT = 'redirect'
4
4
  NAVIGATION = 'navigation'
5
5
  CONTENT = 'content'
6
+ CUSTOM = 'custom'
6
7
 
7
8
  def self.all
8
- [CONTENT, REDIRECT, NAVIGATION]
9
+ [CONTENT, REDIRECT, NAVIGATION, CUSTOM]
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,9 @@
1
+ = simple_form_for([:cms, resource], wrapper: :bootstrap) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ - resource.class.editable_attributes.each do |column_name|
6
+ = model_attribute_field(resource, column_name, f)
7
+
8
+ .form-actions
9
+ = f.button :submit
data/config/routes.rb CHANGED
@@ -26,5 +26,5 @@ Kuhsaft::Engine.routes.draw do
26
26
  end
27
27
 
28
28
  get '/pages/:id' => 'pages#lookup_by_id'
29
- get '/sitemap.format' => 'sitemaps#index', format: 'xml'
29
+ get '/sitemap' => 'sitemaps#index', format: 'xml'
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = '2.4.3'
2
+ VERSION = '2.5.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::Api::PagesController do
3
+ describe Kuhsaft::Api::PagesController, type: :controller do
4
4
  describe '#index' do
5
5
  before do
6
6
  @pages = []
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::PagesController do
3
+ describe Kuhsaft::PagesController, type: :controller do
4
4
  subject { described_class }
5
5
 
6
6
  describe '#index' do
@@ -16,7 +16,7 @@ describe Kuhsaft::PagesController do
16
16
  I18n.with_locale :de do
17
17
  get(:index, use_route: :kuhsaft, search: 'foobar')
18
18
  end
19
- assigns(:pages).should eq([@pages.first])
19
+ expect(assigns(:pages)).to eq([@pages.first])
20
20
  end
21
21
  end
22
22
  end
@@ -33,7 +33,7 @@ describe Kuhsaft::PagesController do
33
33
  I18n.with_locale(:de) do
34
34
  get(:show, use_route: :kuhsaft)
35
35
  end
36
- assigns(:page).should eq(@page)
36
+ expect(assigns(:page)).to eq(@page)
37
37
  end
38
38
  end
39
39
 
@@ -59,7 +59,7 @@ describe Kuhsaft::PagesController do
59
59
  page = FactoryGirl.create(:page, slug: 'dumdidum',
60
60
  url: 'de/dumdidum')
61
61
  get :show, url: page.slug, use_route: :kuhsaft
62
- assigns(:page).should eq(page)
62
+ expect(assigns(:page)).to eq(page)
63
63
  end
64
64
  end
65
65
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::SitemapsController do
3
+ describe Kuhsaft::SitemapsController, type: :controller do
4
4
  describe '#index' do
5
5
  before do
6
6
  @page = FactoryGirl.create(:page)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'Cms/Pages' do
5
+ describe 'Cms/Pages', type: :feature do
6
6
 
7
7
  context '#new' do
8
8
  before do
@@ -19,7 +19,7 @@ describe 'Cms/Pages' do
19
19
  end
20
20
 
21
21
  it 'is not possible to change the value in url' do
22
- page.find('#page_url')['disabled'].should be_true
22
+ expect(page.find('#page_url')['disabled']).to be_truthy
23
23
  end
24
24
  end
25
25
 
@@ -32,7 +32,7 @@ describe 'Cms/Pages' do
32
32
  within '.nav-pills' do
33
33
  click_on 'EN'
34
34
  end
35
- page.should have_content(@page.title_en)
35
+ expect(page).to have_content(@page.title_en)
36
36
  end
37
37
  end
38
38
  end
@@ -52,7 +52,7 @@ describe 'Cms/Pages' do
52
52
 
53
53
  it 'is invalid when no value is in redirect_page' do
54
54
  click_on 'Update Page'
55
- page.should have_css('.error', count: 1)
55
+ expect(page).to have_css('.error', count: 1)
56
56
  end
57
57
 
58
58
  it 'does not change the value in url' do
@@ -70,7 +70,7 @@ describe 'Cms/Pages' do
70
70
  invalid_brick.save(validate: false)
71
71
 
72
72
  visit kuhsaft.edit_cms_page_path(@page)
73
- page.should have_css('.error', count: 1)
73
+ expect(page).to have_css('.error', count: 1)
74
74
  end
75
75
  end
76
76
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'pages#index' do
3
+ describe 'pages#index', type: :feature do
4
4
  context 'with search parameter' do
5
5
  let! :page1 do
6
6
  p = create :page,
@@ -31,12 +31,12 @@ describe 'pages#index' do
31
31
 
32
32
  it 'highlights search term in preview' do
33
33
  within('ul.search-results.success') do
34
- page.should have_content('Chromodorididae')
34
+ expect(page).to have_content('Chromodorididae')
35
35
  end
36
36
  end
37
37
 
38
38
  it 'truncates the text' do
39
- find('.summary .excerpt').text.length.should == 110
39
+ expect(find('.summary .excerpt').text.length).to eq(110)
40
40
  end
41
41
  end
42
42
 
@@ -46,21 +46,21 @@ describe 'pages#index' do
46
46
  end
47
47
 
48
48
  it 'renders match count' do
49
- page.should have_content('2 results')
49
+ expect(page).to have_content('2 results')
50
50
  end
51
51
 
52
52
  it 'renders the search results list' do
53
53
  within('ul.search-results.success') do
54
- page.should have_content('Chromodorididae Ardeadoris')
55
- page.should have_content('Chromodorididae Berlanguella')
56
- page.should_not have_content('Gastropoda')
54
+ expect(page).to have_content('Chromodorididae Ardeadoris')
55
+ expect(page).to have_content('Chromodorididae Berlanguella')
56
+ expect(page).not_to have_content('Gastropoda')
57
57
  end
58
58
  end
59
59
 
60
60
  it 'renders links to the pages' do
61
61
  within('ul.search-results.success') do
62
- page.should have_link('Chromodorididae Ardeadoris', href: page1.link)
63
- page.should have_link('Chromodorididae Berlanguella', href: page2.link)
62
+ expect(page).to have_link('Chromodorididae Ardeadoris', href: page1.link)
63
+ expect(page).to have_link('Chromodorididae Berlanguella', href: page2.link)
64
64
  end
65
65
  end
66
66
  end
@@ -71,7 +71,7 @@ describe 'pages#index' do
71
71
  end
72
72
 
73
73
  it 'renders match count' do
74
- page.should have_content('No results')
74
+ expect(page).to have_content('No results')
75
75
  end
76
76
  end
77
77
  end
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::Cms::AdminHelper do
3
+ describe Kuhsaft::Cms::AdminHelper, type: :helper do
4
4
  describe '#render_language_switch?' do
5
5
  context 'when there is one language' do
6
6
  before do
7
- I18n.stub(:available_locales).and_return([:de])
7
+ allow(I18n).to receive(:available_locales).and_return([:de])
8
8
  end
9
9
 
10
10
  it 'returns false' do
11
- helper.render_language_switch?.should be_false
11
+ expect(helper.render_language_switch?).to be_falsey
12
12
  end
13
13
  end
14
14
 
15
15
  context 'when there are multiple languages' do
16
16
  before do
17
- I18n.stub(:available_locales).and_return([:de, :en])
17
+ allow(I18n).to receive(:available_locales).and_return([:de, :en])
18
18
  end
19
19
 
20
20
  it 'returns true' do
21
- helper.render_language_switch?.should be_true
21
+ expect(helper.render_language_switch?).to be_truthy
22
22
  end
23
23
  end
24
24
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::Cms::PagesHelper do
3
+ describe Kuhsaft::Cms::PagesHelper, type: :helper do
4
4
  describe '#content_tab_active' do
5
5
  it 'returns active when page has a title and no errors' do
6
6
  @page = create(:page, title: 'Page 1', slug: 'page1')
@@ -28,19 +28,19 @@ describe Kuhsaft::Cms::PagesHelper do
28
28
  it 'has a page without translations' do
29
29
  @page = create(:page, title: 'Page 1', slug: 'page1')
30
30
  I18n.with_locale :de do
31
- expect(helper.hide_content_tab?(@page)).to be_true
31
+ expect(helper.hide_content_tab?(@page)).to be_truthy
32
32
  end
33
33
  end
34
34
 
35
35
  it 'has a redirect page' do
36
36
  @page = create(:page, title: 'Page 1', slug: 'page1',
37
37
  page_type: Kuhsaft::PageType::REDIRECT, redirect_url: 'en/references')
38
- expect(helper.hide_content_tab?(@page)).to be_true
38
+ expect(helper.hide_content_tab?(@page)).to be_truthy
39
39
  end
40
40
 
41
41
  it 'has a not saved page' do
42
42
  @page = Kuhsaft::Page.new
43
- expect(helper.hide_content_tab?(@page)).to be_true
43
+ expect(helper.hide_content_tab?(@page)).to be_truthy
44
44
  end
45
45
  end
46
46
  end
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe PagesHelper do
3
+ describe PagesHelper, type: :helper do
4
4
  describe '#search_page_form' do
5
5
 
6
6
  context 'without block' do
7
7
  it 'renders the default search form' do
8
8
  form = search_page_form
9
- form.should have_css('form.form-inline')
10
- form.should have_css('input[type=text]')
11
- form.should have_css('input[type=submit]')
9
+ expect(form).to have_css('form.form-inline')
10
+ expect(form).to have_css('input[type=text]')
11
+ expect(form).to have_css('input[type=submit]')
12
12
  end
13
13
  end
14
14
 
data/spec/kuhsaft_spec.rb CHANGED
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Kuhsaft do
4
4
  it 'should be valid' do
5
- Kuhsaft.should be_a(Module)
5
+ expect(Kuhsaft).to be_a(Module)
6
6
  end
7
7
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'rspec/active_model/mocks'
2
3
 
3
4
  describe Kuhsaft::BrickList do
4
5
 
@@ -13,21 +14,22 @@ describe Kuhsaft::BrickList do
13
14
  describe '#collect_fulltext' do
14
15
  context 'with bricks' do
15
16
  it 'collects its childs fulltext' do
16
- brick.stub_chain(:bricks, :localized).and_return([mock_model(Kuhsaft::Brick, collect_fulltext: 'hallo')])
17
- brick.collect_fulltext.should == 'hallo'
17
+ result = [mock_model(Kuhsaft::Brick, collect_fulltext: 'hallo')]
18
+ allow(brick).to receive_message_chain(:bricks, :localized).and_return(result)
19
+ expect(brick.collect_fulltext).to eq('hallo')
18
20
  end
19
21
  end
20
22
 
21
23
  context 'with bricks without content' do
22
24
  it 'returns a string' do
23
- brick.stub_chain(:bricks, :localized).and_return([])
24
- brick.collect_fulltext.should == ''
25
+ allow(brick).to receive_message_chain(:bricks, :localized).and_return([])
26
+ expect(brick.collect_fulltext).to eq('')
25
27
  end
26
28
  end
27
29
 
28
30
  context 'without bricks' do
29
31
  it 'returns a string' do
30
- brick.collect_fulltext.should == ''
32
+ expect(brick.collect_fulltext).to eq('')
31
33
  end
32
34
 
33
35
  it 'does not fail' do
@@ -38,13 +40,13 @@ describe Kuhsaft::BrickList do
38
40
 
39
41
  describe '#allowed_brick_types' do
40
42
  it 'returns an array of possible classes as strings' do
41
- brick.allowed_brick_types.should be_a(Array)
43
+ expect(brick.allowed_brick_types).to be_a(Array)
42
44
  end
43
45
  end
44
46
 
45
47
  describe '#brick_types' do
46
48
  it 'returns a Kuhsaft::BrickTypeFilter' do
47
- brick.brick_types.should be_a(Kuhsaft::BrickTypeFilter)
49
+ expect(brick.brick_types).to be_a(Kuhsaft::BrickTypeFilter)
48
50
  end
49
51
  end
50
52
  end
@@ -6,14 +6,14 @@ describe Kuhsaft::Engine do
6
6
 
7
7
  describe '.image_sizes' do
8
8
  it 'delegates .clear to ImageSize' do
9
- Kuhsaft::ImageSize.should_receive(:clear!)
9
+ expect(Kuhsaft::ImageSize).to receive(:clear!)
10
10
  Kuhsaft::Engine.configure do
11
11
  config.image_sizes.clear!
12
12
  end
13
13
  end
14
14
 
15
15
  it 'delegates .add to ImageSize' do
16
- Kuhsaft::ImageSize.should_receive(:add).with(:something, 100, 200)
16
+ expect(Kuhsaft::ImageSize).to receive(:add).with(:something, 100, 200)
17
17
  Kuhsaft::Engine.configure do
18
18
  config.image_sizes.add(:something, 100, 200)
19
19
  end
@@ -13,12 +13,12 @@ describe Kuhsaft::Gridded do
13
13
 
14
14
  it 'returns false on gridded? if no col count is set' do
15
15
  expect_any_instance_of(GridClass).to receive(:col_count).at_least(:once).and_return(0)
16
- expect(GridClass.new.gridded?).to be_false
16
+ expect(GridClass.new.gridded?).to be_falsey
17
17
  end
18
18
 
19
19
  it 'returns true on gridded? if a col count is set' do
20
20
  expect_any_instance_of(GridClass).to receive(:col_count).at_least(:once).and_return(10)
21
- expect(GridClass.new.gridded?).to be_true
21
+ expect(GridClass.new.gridded?).to be_truthy
22
22
  end
23
23
  end
24
24
  end
@@ -8,7 +8,7 @@ describe Kuhsaft::ImageUploaderMounting do
8
8
 
9
9
  describe '#uploader_mounting' do
10
10
  it 'has a uploader mounted' do
11
- brick.class.ancestors.include?(CarrierWave::Mount::Extension).should be_true
11
+ expect(brick.class.ancestors.include?(CarrierWave::Mount::Extension)).to be_truthy
12
12
  end
13
13
  end
14
14
  end
@@ -29,9 +29,9 @@ module Kuhsaft
29
29
 
30
30
  it 'sets the correct parent attribute for the nodes' do
31
31
  PageTree.update(page_tree)
32
- @page1.reload.parent_id.should be_nil
32
+ expect(@page1.reload.parent_id).to be_nil
33
33
  expect(@page2.reload.parent_id).to eq(1)
34
- @page3.reload.parent_id.should be nil
34
+ expect(@page3.reload.parent_id).to be nil
35
35
  end
36
36
  end
37
37
  end
@@ -20,7 +20,7 @@ describe Kuhsaft::Searchable do
20
20
  context 'without postgresql' do
21
21
  it 'initializes scope' do
22
22
  expect(ActiveRecord::Base.connection.instance_values).not_to eq('postgresql')
23
- SearchableDemo.should_receive :scope
23
+ expect(SearchableDemo).to receive :scope
24
24
  SearchableDemo.class_eval do
25
25
  include Kuhsaft::Searchable
26
26
  end
@@ -40,23 +40,23 @@ describe Kuhsaft::Translatable do
40
40
 
41
41
  describe 'translated attributes' do
42
42
  it 'delegates the getter to the suffixed attribute' do
43
- model.should_receive(:name_en).and_return('John')
44
- model.name.should == 'John'
43
+ expect(model).to receive(:name_en).and_return('John')
44
+ expect(model.name).to eq('John')
45
45
  end
46
46
 
47
47
  it 'delegates the setter to the suffixed attribute' do
48
- model.should_receive(:name_en=).with('Johnny')
48
+ expect(model).to receive(:name_en=).with('Johnny')
49
49
  model.name = 'Johnny'
50
50
  end
51
51
 
52
52
  context 'dynamic methods' do
53
53
  it 'delegates boolean accessors' do
54
- model.should_receive(:name_en?)
54
+ expect(model).to receive(:name_en?)
55
55
  model.name?
56
56
  end
57
57
 
58
58
  it 'delegates simple dynamic finders' do
59
- Demo.should_receive(:find_by_name_en).with('Max')
59
+ expect(Demo).to receive(:find_by_name_en).with('Max')
60
60
  Demo.find_by_name('Max')
61
61
  end
62
62
  end
@@ -67,12 +67,12 @@ describe Kuhsaft::Translatable do
67
67
  end
68
68
 
69
69
  it 'delegates the getter to current locale' do
70
- model.should_receive(:name_de).and_return('Johannes')
71
- model.name.should == 'Johannes'
70
+ expect(model).to receive(:name_de).and_return('Johannes')
71
+ expect(model.name).to eq('Johannes')
72
72
  end
73
73
 
74
74
  it 'delegates the getter to current locale' do
75
- model.should_receive(:name_de=).with('Johannes')
75
+ expect(model).to receive(:name_de=).with('Johannes')
76
76
  model.name = 'Johannes'
77
77
  end
78
78
  end
@@ -114,23 +114,23 @@ describe Kuhsaft::Translatable do
114
114
 
115
115
  describe 'translated attributes' do
116
116
  it 'delegates the getter to the suffixed attribute' do
117
- model.should_receive(:name_de_ch).and_return('John')
118
- model.name.should == 'John'
117
+ expect(model).to receive(:name_de_ch).and_return('John')
118
+ expect(model.name).to eq('John')
119
119
  end
120
120
 
121
121
  it 'delegates the setter to the suffixed attribute' do
122
- model.should_receive(:name_de_ch=).with('Johnny')
122
+ expect(model).to receive(:name_de_ch=).with('Johnny')
123
123
  model.name = 'Johnny'
124
124
  end
125
125
 
126
126
  context 'dynamic methods' do
127
127
  it 'delegates boolean accessors' do
128
- model.should_receive(:name_de_ch?)
128
+ expect(model).to receive(:name_de_ch?)
129
129
  model.name?
130
130
  end
131
131
 
132
132
  it 'delegates simple dynamic finders' do
133
- Demo.should_receive(:find_by_name_de_ch).with('Max')
133
+ expect(Demo).to receive(:find_by_name_de_ch).with('Max')
134
134
  Demo.find_by_name('Max')
135
135
  end
136
136
  end
@@ -141,12 +141,12 @@ describe Kuhsaft::Translatable do
141
141
  end
142
142
 
143
143
  it 'delegates the getter to current locale' do
144
- model.should_receive(:name_de).and_return('Johannes')
145
- model.name.should == 'Johannes'
144
+ expect(model).to receive(:name_de).and_return('Johannes')
145
+ expect(model.name).to eq('Johannes')
146
146
  end
147
147
 
148
148
  it 'delegates the getter to current locale' do
149
- model.should_receive(:name_de=).with('Johannes')
149
+ expect(model).to receive(:name_de=).with('Johannes')
150
150
  model.name = 'Johannes'
151
151
  end
152
152
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::AccordionBrick do
3
+ describe Kuhsaft::AccordionBrick, type: :model do
4
4
 
5
5
  let :accordion_brick do
6
6
  Kuhsaft::AccordionBrick.new
@@ -8,31 +8,31 @@ describe Kuhsaft::AccordionBrick do
8
8
 
9
9
  describe '#user_can_delete?' do
10
10
  it 'returns true' do
11
- accordion_brick.user_can_delete?.should be_true
11
+ expect(accordion_brick.user_can_delete?).to be_truthy
12
12
  end
13
13
  end
14
14
 
15
15
  describe '#renders_own_childs?' do
16
16
  it 'returns false' do
17
- accordion_brick.renders_own_childs?.should be_false
17
+ expect(accordion_brick.renders_own_childs?).to be_falsey
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#bricks' do
22
22
  it 'can have childs' do
23
- accordion_brick.should respond_to(:bricks)
23
+ expect(accordion_brick).to respond_to(:bricks)
24
24
  end
25
25
  end
26
26
 
27
27
  describe '#to_style_class' do
28
28
  it 'includes the bootstrap classname' do
29
- accordion_brick.to_style_class.should == 'kuhsaft-accordion-brick accordion'
29
+ expect(accordion_brick.to_style_class).to eq('kuhsaft-accordion-brick accordion')
30
30
  end
31
31
  end
32
32
 
33
33
  describe '#allowed_brick_types' do
34
34
  it 'only allows AccordionItems' do
35
- accordion_brick.allowed_brick_types.should == %w(Kuhsaft::AccordionItemBrick)
35
+ expect(accordion_brick.allowed_brick_types).to eq(%w(Kuhsaft::AccordionItemBrick))
36
36
  end
37
37
  end
38
38
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::AccordionItemBrick do
3
+ describe Kuhsaft::AccordionItemBrick, type: :model do
4
4
 
5
5
  let :accordion_item_brick do
6
6
  Kuhsaft::AccordionItemBrick.new
@@ -13,38 +13,38 @@ describe Kuhsaft::AccordionItemBrick do
13
13
 
14
14
  context 'without a #caption' do
15
15
  it 'has en error' do
16
- accordion_item_brick.should have(1).error_on(:caption)
16
+ expect(accordion_item_brick.errors[:caption].count).to eq(1)
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#user_can_delete?' do
22
22
  it 'returns true' do
23
- accordion_item_brick.user_can_delete?.should be_true
23
+ expect(accordion_item_brick.user_can_delete?).to be_truthy
24
24
  end
25
25
  end
26
26
 
27
27
  describe '#user_can_save' do
28
28
  it 'returns true' do
29
- accordion_item_brick.user_can_save?.should == true
29
+ expect(accordion_item_brick.user_can_save?).to eq(true)
30
30
  end
31
31
  end
32
32
 
33
33
  describe '#renders_own_childs?' do
34
34
  it 'returns false' do
35
- accordion_item_brick.renders_own_childs?.should be_false
35
+ expect(accordion_item_brick.renders_own_childs?).to be_falsey
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#bricks' do
40
40
  it 'can have childs' do
41
- accordion_item_brick.should respond_to(:bricks)
41
+ expect(accordion_item_brick).to respond_to(:bricks)
42
42
  end
43
43
  end
44
44
 
45
45
  describe '#to_style_class' do
46
46
  it 'includes the bootstrap classname' do
47
- accordion_item_brick.to_style_class.should == 'kuhsaft-accordion-item-brick accordion-group'
47
+ expect(accordion_item_brick.to_style_class).to eq('kuhsaft-accordion-item-brick accordion-group')
48
48
  end
49
49
  end
50
50
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::AnchorBrick do
3
+ describe Kuhsaft::AnchorBrick, type: :model do
4
4
 
5
5
  let :anchor_brick do
6
6
  Kuhsaft::AnchorBrick.new(caption: 'test-anchor')
@@ -8,19 +8,19 @@ describe Kuhsaft::AnchorBrick do
8
8
 
9
9
  describe '#bricks' do
10
10
  it 'can not have childs' do
11
- anchor_brick.should_not respond_to(:bricks)
11
+ expect(anchor_brick).not_to respond_to(:bricks)
12
12
  end
13
13
  end
14
14
 
15
15
  describe '#user_can_add_childs?' do
16
16
  it 'returns false' do
17
- anchor_brick.user_can_add_childs?.should be_false
17
+ expect(anchor_brick.user_can_add_childs?).to be_falsey
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#to_id' do
22
22
  it 'returns a parameterized id' do
23
- anchor_brick.to_id.should == 'anchor-test-anchor'
23
+ expect(anchor_brick.to_id).to eq('anchor-test-anchor')
24
24
  end
25
25
  end
26
26
  end