bit_core 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ module BitCore
4
+ describe ContentModule do
5
+ fixtures :"bit_core/tools", :"bit_core/content_modules",
6
+ :"bit_core/content_providers"
7
+
8
+ describe "#provider" do
9
+ it "should return the Null Provider when one is not found" do
10
+ provider = bit_core_content_modules(:home_landing).provider(8)
11
+ expect(provider.position).to eq(8)
12
+ expect(provider.class).to eq(ContentProviders::Null)
13
+ end
14
+
15
+ it "should return the associated provider at the position" do
16
+ provider = bit_core_content_modules(:home_landing).provider(1)
17
+ expect(provider.position).to eq(1)
18
+ expect(provider.class).not_to eq(ContentProviders::Null)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ require "spec_helper"
2
+
3
+ module BitCore
4
+ describe ContentProvider do
5
+ describe "validations" do
6
+ it "should validate the existence of the template path" do
7
+ p = ContentProvider.new(template_path: "foobaz")
8
+ p.valid?
9
+
10
+ expect(p.errors[:template_path].length).to eq 1
11
+
12
+ p.template_path = "layouts"
13
+ p.valid?
14
+
15
+ expect(p.errors[:template_path].length).to eq 0
16
+ end
17
+
18
+ it "should validate the existence of the data class" do
19
+ p = ContentProvider.new(data_class_name: "foobaz")
20
+ p.valid?
21
+
22
+ expect(p.errors[:data_class_name].length).to eq 1
23
+
24
+ p.data_class_name = "BitCore::ContentProvider"
25
+ p.valid?
26
+
27
+ expect(p.errors[:data_class_name].length).to eq 0
28
+ end
29
+
30
+ it "should validate the existence of the data attributes" do
31
+ p = ContentProvider.new(
32
+ data_class_name: "BitCore::ContentProvider",
33
+ data_attributes: %w(baz)
34
+ )
35
+ p.valid?
36
+
37
+ expect(p.errors[:data_attributes].length).to eq 1
38
+
39
+ p.data_attributes = %w(id data_attributes)
40
+ p.valid?
41
+
42
+ expect(p.errors[:data_attributes].length).to eq 0
43
+ end
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bit_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-20 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,8 @@ files:
94
94
  - app/controllers/bit_core/application_controller.rb
95
95
  - app/models/bit_core/content_module.rb
96
96
  - app/models/bit_core/content_provider.rb
97
+ - app/models/bit_core/content_providers/null.rb
98
+ - app/models/bit_core/content_providers/slideshow_provider.rb
97
99
  - app/models/bit_core/slide.rb
98
100
  - app/models/bit_core/slideshow.rb
99
101
  - app/models/bit_core/tool.rb
@@ -107,6 +109,7 @@ files:
107
109
  - db/migrate/20140417173056_create_bit_core_slideshows.rb
108
110
  - db/migrate/20140417174159_create_bit_core_slides.rb
109
111
  - db/migrate/20140620174146_add_options_to_slides.rb
112
+ - db/migrate/20140620174147_add_config_fields_to_providers.rb
110
113
  - lib/bit_core.rb
111
114
  - lib/bit_core/engine.rb
112
115
  - lib/bit_core/version.rb
@@ -139,7 +142,6 @@ files:
139
142
  - spec/dummy/config/locales/en.yml
140
143
  - spec/dummy/config/routes.rb
141
144
  - spec/dummy/config/secrets.yml
142
- - spec/dummy/db/schema.rb
143
145
  - spec/dummy/log/development.log
144
146
  - spec/dummy/log/test.log
145
147
  - spec/dummy/public/404.html
@@ -151,6 +153,8 @@ files:
151
153
  - spec/fixtures/bit_core/slides.yml
152
154
  - spec/fixtures/bit_core/slideshows.yml
153
155
  - spec/fixtures/bit_core/tools.yml
156
+ - spec/models/bit_core/content_module_spec.rb
157
+ - spec/models/bit_core/content_provider_spec.rb
154
158
  - spec/models/bit_core/slide_spec.rb
155
159
  - spec/models/bit_core/slideshow_spec.rb
156
160
  - spec/spec_helper.rb
@@ -205,7 +209,6 @@ test_files:
205
209
  - spec/dummy/config/routes.rb
206
210
  - spec/dummy/config/secrets.yml
207
211
  - spec/dummy/config.ru
208
- - spec/dummy/db/schema.rb
209
212
  - spec/dummy/log/development.log
210
213
  - spec/dummy/log/test.log
211
214
  - spec/dummy/public/404.html
@@ -219,6 +222,8 @@ test_files:
219
222
  - spec/fixtures/bit_core/slides.yml
220
223
  - spec/fixtures/bit_core/slideshows.yml
221
224
  - spec/fixtures/bit_core/tools.yml
225
+ - spec/models/bit_core/content_module_spec.rb
226
+ - spec/models/bit_core/content_provider_spec.rb
222
227
  - spec/models/bit_core/slide_spec.rb
223
228
  - spec/models/bit_core/slideshow_spec.rb
224
229
  - spec/spec_helper.rb
@@ -1,70 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20140620174146) do
15
-
16
- # These are extensions that must be enabled in order to support this database
17
- enable_extension "plpgsql"
18
-
19
- create_table "bit_core_content_modules", force: true do |t|
20
- t.string "title", null: false
21
- t.integer "position", default: 1, null: false
22
- t.integer "bit_core_tool_id", null: false
23
- t.datetime "created_at"
24
- t.datetime "updated_at"
25
- end
26
-
27
- add_index "bit_core_content_modules", ["bit_core_tool_id", "position"], name: "bit_core_content_module_position", unique: true, using: :btree
28
-
29
- create_table "bit_core_content_providers", force: true do |t|
30
- t.string "type", null: false
31
- t.string "source_content_type"
32
- t.integer "source_content_id"
33
- t.integer "bit_core_content_module_id", null: false
34
- t.integer "position", default: 1, null: false
35
- t.datetime "created_at"
36
- t.datetime "updated_at"
37
- end
38
-
39
- add_index "bit_core_content_providers", ["bit_core_content_module_id", "position"], name: "bit_core_content_provider_position", unique: true, using: :btree
40
-
41
- create_table "bit_core_slides", force: true do |t|
42
- t.string "title", null: false
43
- t.text "body", null: false
44
- t.integer "position", default: 1, null: false
45
- t.integer "bit_core_slideshow_id", null: false
46
- t.string "type"
47
- t.boolean "is_title_visible", default: true, null: false
48
- t.datetime "created_at"
49
- t.datetime "updated_at"
50
- t.text "options"
51
- end
52
-
53
- add_index "bit_core_slides", ["bit_core_slideshow_id", "position"], name: "bit_core_slide_position", unique: true, using: :btree
54
-
55
- create_table "bit_core_slideshows", force: true do |t|
56
- t.string "title", null: false
57
- t.datetime "created_at"
58
- t.datetime "updated_at"
59
- end
60
-
61
- create_table "bit_core_tools", force: true do |t|
62
- t.string "title", null: false
63
- t.integer "position", default: 0, null: false
64
- t.datetime "created_at"
65
- t.datetime "updated_at"
66
- end
67
-
68
- add_index "bit_core_tools", ["position"], name: "bit_core_tool_position", unique: true, using: :btree
69
-
70
- end