classiccms 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,9 @@ module Classiccms
8
8
 
9
9
  #insert the header for CMS to work
10
10
  def cms
11
- show :header, views: File.join(Classiccms::ROOT, 'views/cms')
11
+ if defined? @user
12
+ show :header, views: File.join(Classiccms::ROOT, 'views/cms')
13
+ end
12
14
  end
13
15
 
14
16
  #insert the logout button
@@ -21,7 +21,7 @@ module Classiccms
21
21
  end
22
22
  new = Array.new
23
23
  branches.each do |branch|
24
- if new.count == 0 or new.count > branch.count
24
+ if branch != nil and (new.count == 0 or new.count > branches.count)
25
25
  new = branch
26
26
  end
27
27
  end
@@ -2,3 +2,4 @@ vendor/**/*
2
2
  .bin/*
3
3
  .sass-cache/**
4
4
  .bundle/*
5
+ assets/**/*
@@ -10,7 +10,7 @@ defaults: &defaults
10
10
 
11
11
  development:
12
12
  <<: *defaults
13
- database: $_production
13
+ database: $_development
14
14
 
15
15
  test:
16
16
  <<: *defaults
@@ -1,3 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
data/spec/helpers_spec.rb CHANGED
@@ -28,8 +28,16 @@ describe Classiccms do
28
28
  end
29
29
  end
30
30
  describe 'cms helper' do
31
- it 'should render cms' do
31
+ it 'should not render cms if not logged in' do
32
32
  with_constants :CONFIG => {:home => 'application/cms'} do
33
+ set_file 'views/application/cms.haml', "= cms"
34
+ get '/'
35
+ last_response.body.should_not match('script')
36
+ end
37
+ end
38
+ it 'should render cms if logged in' do
39
+ with_constants :CONFIG => {:home => 'application/cms'} do
40
+ login
33
41
  set_file 'views/application/cms.haml', "= cms"
34
42
  get '/'
35
43
  last_response.body.should match('script')
@@ -71,5 +71,9 @@ describe Classiccms do
71
71
  m2 = Menu.create connections: [Connection.new(parent_id: m1.id)]
72
72
  get_route(m2).should == [m2.id, m1.id]
73
73
  end
74
+ it 'should return something' do
75
+ m1 = Menu.create connections: [Connection.new(parent_id: nil)]
76
+ get_route(m1).should == [m1.id]
77
+ end
74
78
  end
75
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classiccms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
12
+ date: 2012-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec