constructor-core 0.3.2 → 0.3.3
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.
- data/config/initializers/devise.rb +0 -7
- data/constructor-core.gemspec +10 -4
- data/lib/constructor_core/version.rb +3 -0
- metadata +23 -16
- data/spec/factories.rb +0 -2
- data/spec/lib/nav/group_spec.rb +0 -61
- data/spec/lib/nav/item_spec.rb +0 -151
- data/spec/lib/nav_lib_spec.rb +0 -60
- data/spec/spec_helper.rb +0 -34
@@ -9,9 +9,6 @@ Devise.setup do |config|
|
|
9
9
|
# Configure the class responsible to send e-mails.
|
10
10
|
# config.mailer = "Devise::Mailer"
|
11
11
|
|
12
|
-
# Automatically apply schema changes in tableless databases
|
13
|
-
config.apply_schema = false
|
14
|
-
|
15
12
|
# ==> ORM configuration
|
16
13
|
# Load and configure the ORM. Supports :active_record (default) and
|
17
14
|
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
@@ -111,10 +108,6 @@ Devise.setup do |config|
|
|
111
108
|
# If true, extends the user's remember period when remembered via cookie.
|
112
109
|
# config.extend_remember_period = false
|
113
110
|
|
114
|
-
# If true, uses the password salt as remember token. This should be turned
|
115
|
-
# to false if you are not using database authenticatable.
|
116
|
-
config.use_salt_as_remember_token = true
|
117
|
-
|
118
111
|
# Options to be passed to the created cookie. For instance, you can set
|
119
112
|
# :secure => true in order to force SSL only cookies.
|
120
113
|
# config.cookie_options = {}
|
data/constructor-core.gemspec
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require File.expand_path('../../core/lib/constructor_core/version', __FILE__)
|
4
|
+
|
3
5
|
Gem::Specification.new do |s|
|
4
6
|
s.platform = Gem::Platform::RUBY
|
5
7
|
s.name = %q{constructor-core}
|
6
|
-
s.version =
|
7
|
-
s.summary = %q{
|
8
|
+
s.version = ConstructorCore::VERSION
|
9
|
+
s.summary = %q{Core for Constructor CMS}
|
10
|
+
s.summary = %q{Constructor Core}
|
8
11
|
s.authors = ['Ivan Zotov']
|
9
12
|
s.require_paths = %w(lib)
|
13
|
+
s.description = 'Core for Constructor CMS'
|
14
|
+
s.email = 'ivanzotov@gmail.com'
|
10
15
|
|
11
16
|
s.files = `git ls-files`.split("\n")
|
12
17
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
13
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
|
-
|
15
|
-
s.add_dependency '
|
19
|
+
|
20
|
+
s.add_dependency 'rails', '~> 3.2.13'
|
21
|
+
s.add_dependency 'devise'
|
16
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constructor-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.13
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.13
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: devise
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,8 +43,8 @@ dependencies:
|
|
27
43
|
- - ! '>='
|
28
44
|
- !ruby/object:Gem::Version
|
29
45
|
version: '0'
|
30
|
-
description:
|
31
|
-
email:
|
46
|
+
description: Core for Constructor CMS
|
47
|
+
email: ivanzotov@gmail.com
|
32
48
|
executables: []
|
33
49
|
extensions: []
|
34
50
|
extra_rdoc_files: []
|
@@ -96,11 +112,7 @@ files:
|
|
96
112
|
- db/migrate/2_add_default_user.rb
|
97
113
|
- lib/constructor-core.rb
|
98
114
|
- lib/constructor_core/engine.rb
|
99
|
-
-
|
100
|
-
- spec/lib/nav/group_spec.rb
|
101
|
-
- spec/lib/nav/item_spec.rb
|
102
|
-
- spec/lib/nav_lib_spec.rb
|
103
|
-
- spec/spec_helper.rb
|
115
|
+
- lib/constructor_core/version.rb
|
104
116
|
- vendor/assets/javascripts/.gitkeep
|
105
117
|
- vendor/assets/javascripts/ckeditor/ckeditor.js
|
106
118
|
- vendor/assets/javascripts/ckeditor/config.js
|
@@ -272,10 +284,5 @@ rubyforge_project:
|
|
272
284
|
rubygems_version: 1.8.25
|
273
285
|
signing_key:
|
274
286
|
specification_version: 3
|
275
|
-
summary:
|
276
|
-
test_files:
|
277
|
-
- spec/factories.rb
|
278
|
-
- spec/lib/nav/group_spec.rb
|
279
|
-
- spec/lib/nav/item_spec.rb
|
280
|
-
- spec/lib/nav_lib_spec.rb
|
281
|
-
- spec/spec_helper.rb
|
287
|
+
summary: Constructor Core
|
288
|
+
test_files: []
|
data/spec/factories.rb
DELETED
data/spec/lib/nav/group_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Nav::Group do
|
6
|
-
before :each do
|
7
|
-
@group = Nav::Group.new
|
8
|
-
@item = mock('Nav::Item')
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#items" do
|
12
|
-
it "read @items var" do
|
13
|
-
@group.instance_variable_set(:@items, "Hello world")
|
14
|
-
@group.items.should == "Hello world"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "default is empty array" do
|
18
|
-
@group.instance_variable_get(:@items).should == []
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#add" do
|
23
|
-
context "when arg is Hash" do
|
24
|
-
it "create new item" do
|
25
|
-
Nav::Item.should_receive(:new).with(:name => "New item")
|
26
|
-
@group.add({:name => "New item"})
|
27
|
-
end
|
28
|
-
|
29
|
-
it "add created item to @items" do
|
30
|
-
Nav::Item.stub(:new).and_return(@item)
|
31
|
-
@group.add({:name => "New item"})
|
32
|
-
@group.instance_variable_get(:@items).should == [@item]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "when arg is not Hash" do
|
37
|
-
it "add item to @items" do
|
38
|
-
@group.add(@item)
|
39
|
-
@group.instance_variable_get(:@items).should == [@item]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "when multi-params given" do
|
44
|
-
it "add or create items" do
|
45
|
-
[@item, @item_2].each {|i| i = mock('Nav::Item') }
|
46
|
-
|
47
|
-
Nav::Item.should_receive(:new).with(:name => "New item").and_return(@item_2)
|
48
|
-
@group.add(@item, {:name => "New item"}, @item_3)
|
49
|
-
|
50
|
-
@group.instance_variable_get(:@items).should == [@item, @item_2, @item_3]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "#to_s" do
|
56
|
-
it "render joined items" do
|
57
|
-
@group.instance_variable_set(:@items, ["item", "item_2"])
|
58
|
-
@group.to_s.should == "itemitem_2"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/spec/lib/nav/item_spec.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Nav::Item do
|
6
|
-
describe "@@items" do
|
7
|
-
it "default is empty" do
|
8
|
-
Nav::Item.items.should == []
|
9
|
-
end
|
10
|
-
|
11
|
-
it "cattr_accessor :items" do
|
12
|
-
Nav::Item.items = ["items"]
|
13
|
-
Nav::Item.items.should == ["items"]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
before :each do
|
18
|
-
Nav::Item.items.clear
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#initialize" do
|
22
|
-
context "when params not given" do
|
23
|
-
it "set @attrs default values" do
|
24
|
-
item = Nav::Item.new
|
25
|
-
item.instance_variable_get(:@attrs).should == {
|
26
|
-
:name => "New item",
|
27
|
-
:url => "/",
|
28
|
-
:options => {},
|
29
|
-
:active => false}
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "when params given" do
|
34
|
-
it "merge @attrs with params" do
|
35
|
-
item = Nav::Item.new(:name => "Another name", :url => '/another-url')
|
36
|
-
item.instance_variable_get(:@attrs).should == {
|
37
|
-
:name => "Another name",
|
38
|
-
:url => "/another-url",
|
39
|
-
:options => {},
|
40
|
-
:active => false}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "when add is true (default)" do
|
45
|
-
it "add self to @@items" do
|
46
|
-
item = Nav::Item.new
|
47
|
-
Nav::Item.items.should == [item]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "when add is false" do
|
52
|
-
it "doesn't add self to @@items" do
|
53
|
-
item = Nav::Item.new({}, false)
|
54
|
-
Nav::Item.items.should be_empty
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "#attrs" do
|
60
|
-
it "returns @attrs" do
|
61
|
-
item = Nav::Item.new
|
62
|
-
item.instance_variable_set(:@attrs, "Attrs")
|
63
|
-
item.attrs.should == "Attrs"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "#active?" do
|
68
|
-
it "returns @attrs[:active]" do
|
69
|
-
item = Nav::Item.new
|
70
|
-
attrs = item.instance_variable_get(:@attrs)
|
71
|
-
attrs.merge!({:active => 'test'})
|
72
|
-
item.instance_variable_set(:@attrs, attrs)
|
73
|
-
|
74
|
-
item.active.should == 'test'
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#extract_options" do
|
79
|
-
before :each do
|
80
|
-
@item = Nav::Item.new
|
81
|
-
end
|
82
|
-
|
83
|
-
context "when options is empty" do
|
84
|
-
it "output nothing" do
|
85
|
-
@item.options = {}
|
86
|
-
@item.extract_options.should == ""
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "when options not is empty" do
|
91
|
-
it "extract options to html" do
|
92
|
-
@item.options = {:class => "active", :id => "item"}
|
93
|
-
@item.extract_options.should == " class='active' id='item'"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context "when item active" do
|
98
|
-
it "add 'active' to class " do
|
99
|
-
@item.active = true
|
100
|
-
|
101
|
-
@item.options = {}
|
102
|
-
@item.extract_options.should == " class='active'"
|
103
|
-
|
104
|
-
@item.options = {:class => 'default'}
|
105
|
-
@item.extract_options.should == " class='default active'"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "#to_s" do
|
111
|
-
before :each do
|
112
|
-
@item = Nav::Item.new
|
113
|
-
end
|
114
|
-
|
115
|
-
it "return link with extracted options" do
|
116
|
-
@item.active = false
|
117
|
-
@item.options[:id] = "item"
|
118
|
-
@item.to_s.should == "<li id='item'><a href='#{@item.url}'>#{@item.name}</a></li>"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe "#method_missing" do
|
123
|
-
before :each do
|
124
|
-
@item = Nav::Item.new
|
125
|
-
end
|
126
|
-
|
127
|
-
context "when @attrs include called method name" do
|
128
|
-
context "when method name has equal sign" do
|
129
|
-
it "assign arg to @attrs[:method_name]" do
|
130
|
-
@item.name = "New name"
|
131
|
-
@item.instance_variable_get(:@attrs)[:name].should == "New name"
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context "when method name has no equal sign" do
|
136
|
-
it "return @attrs[:method_name]" do
|
137
|
-
attrs = @item.instance_variable_get(:@attrs)
|
138
|
-
attrs.merge!({:name => "New name 2"})
|
139
|
-
@item.instance_variable_set(:@attrs, attrs)
|
140
|
-
@item.name.should == "New name 2"
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
context "when @attrs not include called method name" do
|
146
|
-
it "raise NoMethodError" do
|
147
|
-
expect {@item.no_method}.to raise_error(NoMethodError)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
data/spec/lib/nav_lib_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Nav do
|
6
|
-
before :each do
|
7
|
-
@item = stub('Nav::Item', :url => '/new-item', :name => "New item")
|
8
|
-
@item_2 = stub('Nav::Item', :url => '/new-item-2', :name => 'New item 2')
|
9
|
-
|
10
|
-
[@item, @item_2].each do |i|
|
11
|
-
i.stub(:attrs).and_return({:url => i.url, :name => i.name})
|
12
|
-
i.stub(:active=) do |arg|
|
13
|
-
i.stub(:active).and_return(arg)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
@items = [@item, @item_2]
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ".select" do
|
21
|
-
context "when request arg not given" do
|
22
|
-
before :each do
|
23
|
-
Nav.request = '/new-item'
|
24
|
-
Nav.select(@items)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "select item if its url eql Nav.request" do
|
28
|
-
@item.active.should be_true
|
29
|
-
end
|
30
|
-
|
31
|
-
it "doesn't select item if its url not eql Nav.request" do
|
32
|
-
@item_2.active.should be_false
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "when request arg given" do
|
37
|
-
before :each do
|
38
|
-
Nav.select(@items, '/new-item-2')
|
39
|
-
end
|
40
|
-
|
41
|
-
it "select item if its url eql request arg" do
|
42
|
-
@item_2.active.should be_true
|
43
|
-
end
|
44
|
-
|
45
|
-
it "doesn't select item if its url not eql request arg" do
|
46
|
-
@item.active.should be_false
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe ".find" do
|
52
|
-
it "return found items" do
|
53
|
-
Nav.find(@items, {:name => "New item 2"}).should == [@item_2]
|
54
|
-
end
|
55
|
-
|
56
|
-
it "return [] if no found" do
|
57
|
-
Nav.find(@items, {:name => "There is no"}).should be_empty
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
require 'rspec/autorun'
|
6
|
-
require 'nav'
|
7
|
-
|
8
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
9
|
-
# in spec/support/ and its subdirectories.
|
10
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
# == Mock Framework
|
14
|
-
#
|
15
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
16
|
-
#
|
17
|
-
# config.mock_with :mocha
|
18
|
-
# config.mock_with :flexmock
|
19
|
-
# config.mock_with :rr
|
20
|
-
config.mock_with :rspec
|
21
|
-
|
22
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
23
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
24
|
-
|
25
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
26
|
-
# examples within a transaction, remove the following line or assign false
|
27
|
-
# instead of true.
|
28
|
-
config.use_transactional_fixtures = true
|
29
|
-
|
30
|
-
# If true, the base class of anonymous controllers will be inferred
|
31
|
-
# automatically. This will be the default behavior in future versions of
|
32
|
-
# rspec-rails.
|
33
|
-
config.infer_base_class_for_anonymous_controllers = false
|
34
|
-
end
|