kayessess 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/app/assets/javascripts/kayessess.js.coffee +1 -0
- data/app/assets/javascripts/kss.coffee +60 -0
- data/app/assets/stylesheets/_constants.scss +38 -0
- data/app/assets/stylesheets/kayessess.css.scss +34 -0
- data/app/assets/stylesheets/layout/_footer.scss +3 -0
- data/app/assets/stylesheets/layout/_header.scss +6 -0
- data/app/assets/stylesheets/layout/_main.scss +4 -0
- data/app/assets/stylesheets/layout/_masthead.scss +8 -0
- data/app/assets/stylesheets/layout/_navigation.scss +11 -0
- data/app/assets/stylesheets/lib/_base.scss +25 -0
- data/app/assets/stylesheets/lib/_functions.scss +27 -0
- data/app/assets/stylesheets/lib/_mixins.scss +64 -0
- data/app/assets/stylesheets/lib/_reset.scss +207 -0
- data/app/assets/stylesheets/lib/_spacing.scss +17 -0
- data/app/assets/stylesheets/lib/_syntax.scss +73 -0
- data/app/assets/stylesheets/modules/_examples.scss +38 -0
- data/app/assets/stylesheets/modules/_section.scss +108 -0
- data/app/controllers/kayessess/application_controller.rb +21 -0
- data/app/controllers/kayessess/sections_controller.rb +32 -0
- data/app/helpers/kayessess/styleguide_helper.rb +40 -0
- data/app/views/kayessess/common/_section_example.html.erb +17 -0
- data/app/views/kayessess/sections/_node.html.erb +11 -0
- data/app/views/kayessess/sections/_section.html.erb +30 -0
- data/app/views/kayessess/sections/example.html.erb +1 -0
- data/app/views/kayessess/sections/index.html.erb +8 -0
- data/app/views/kayessess/sections/show.html.erb +1 -0
- data/app/views/kayessess/styleguides/show.html.erb +3 -0
- data/app/views/layouts/kayessess/application.html.erb +23 -0
- data/app/views/layouts/kayessess/example.html.erb +14 -0
- data/config/routes.rb +7 -0
- data/lib/kayessess.rb +26 -0
- data/lib/kayessess/engine.rb +5 -0
- data/lib/kayessess/node.rb +52 -0
- data/lib/kayessess/section.rb +47 -0
- data/lib/kayessess/section_example.rb +36 -0
- data/lib/kayessess/styleguide.rb +32 -0
- data/lib/kayessess/tree.rb +88 -0
- data/lib/kayessess/version.rb +4 -0
- data/spec/internal/app/assets/stylesheets/_buttons.scss +42 -0
- data/spec/internal/app/assets/stylesheets/_media.scss +47 -0
- data/spec/internal/app/assets/stylesheets/application.css.scss +4 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/db/schema.rb +3 -0
- data/spec/internal/log/test.log +4783 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_button.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_clearfix.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_font-family.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_hide-text.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_html5-input-types.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_position.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_prefixer.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_retina-image.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_size.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_timing-functions.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_triangle.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/2049046df5e7b3a94767f06ad9d0d0796114b6dd/_new-breakpoint.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/2049046df5e7b3a94767f06ad9d0d0796114b6dd/_private.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/2049046df5e7b3a94767f06ad9d0d0796114b6dd/_px-to-em.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_compact.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_flex-grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_grid-width.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_linear-gradient.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_modular-scale.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_px-to-em.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_radial-gradient.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_tint-shade.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/44d6d1a16e832c1fcf2a0d1a6167325825c3eb0d/_transition-property-name.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/4dfc8659f6b1555d2eca193102c23305a928b168/_bourbon-deprecated-upcoming.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/4dfc8659f6b1555d2eca193102c23305a928b168/_bourbon.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_base.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_functions.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_mixins.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_reset.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_spacing.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_animation.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_appearance.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_backface-visibility.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_background-image.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_background.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_border-image.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_border-radius.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_box-sizing.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_columns.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_flex-box.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_font-face.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_hidpi-media-query.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_image-rendering.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_inline-block.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_keyframes.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_linear-gradient.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_perspective.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_placeholder.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_radial-gradient.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_transform.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_transition.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6c489dba74c0c65c297abb80b17831eede932610/_user-select.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/751df40b886f0883d824c8a32ad7e1b78a63ef31/_neat-helpers.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/751df40b886f0883d824c8a32ad7e1b78a63ef31/_neat.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_fill-parent.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_media.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_omega.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_outer-container.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_pad.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_private.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_reset.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_row.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_shift.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_span-columns.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_to-deprecate.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_visual-grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/a28048e3433aec44160545a405511793e0520b02/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/a28048e3433aec44160545a405511793e0520b02/_visual-grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/a41979aab5bf44efb1e4880ffea764e10d77f1fa/_buttons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/a41979aab5bf44efb1e4880ffea764e10d77f1fa/_media.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/a41979aab5bf44efb1e4880ffea764e10d77f1fa/application.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_deprecated-webkit-gradient.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_gradient-positions-parser.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_linear-positions-parser.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_radial-arg-parser.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_radial-positions-parser.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_render-gradients.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/abed7ee14e15589abcbd11bec0e030a0de712857/_shape-size-stripper.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/edf5faa858343614be55813ea5a7f1135eb25f5a/_constants.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/edf5faa858343614be55813ea5a7f1135eb25f5a/styleguide.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0c29d0fb2c8b827e458f500e8ae74379 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/34033ab56926764fc4b0479691b702cb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/7cd1aef370557f982ef64885342d2534 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8ab512c9b33ac90e699b73469d71f061 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/bcca522c6302f184f12fe0e8a7d7e71a +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/c13fc73ceafa45876a901b3e775b83ae +0 -0
- data/spec/lib/node_spec.rb +101 -0
- data/spec/lib/section_spec.rb +47 -0
- data/spec/lib/styleguide_spec.rb +19 -0
- data/spec/lib/tree_spec.rb +60 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/use_coveralls.rb +2 -0
- data/spec/use_simplecov.rb +15 -0
- metadata +567 -0
File without changes
|
data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_button.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/12e26da9dc8e29bde6b3bdb4173aa411e3614e29/_size.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_base.scssc
ADDED
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_mixins.scssc
ADDED
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/5a6e588d52ee67e6c609e7701c027b0390d36093/_reset.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/751df40b886f0883d824c8a32ad7e1b78a63ef31/_neat.scssc
ADDED
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_grid.scssc
ADDED
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_media.scssc
ADDED
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_omega.scssc
ADDED
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_pad.scssc
ADDED
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_reset.scssc
ADDED
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_row.scssc
ADDED
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/9833bdec3b1a6019a06dfc84df9a7abf85e8c6a5/_shift.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/a28048e3433aec44160545a405511793e0520b02/_grid.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
data/spec/internal/tmp/cache/assets/test/sass/a41979aab5bf44efb1e4880ffea764e10d77f1fa/_media.scssc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require_relative "../../lib/kayessess/node"
|
2
|
+
|
3
|
+
describe Kayessess::Node do
|
4
|
+
subject(:node) { Kayessess::Node.new(id, name, parent, children_hash, sections_hash) }
|
5
|
+
let(:id) { 'components' }
|
6
|
+
let(:name) { 'Components' }
|
7
|
+
let(:parent) { double(Kayessess::Node) }
|
8
|
+
let(:children_hash) { double() }
|
9
|
+
let(:sections_hash) { double() }
|
10
|
+
|
11
|
+
describe "#id" do
|
12
|
+
subject { node.id }
|
13
|
+
it { should == id }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#name" do
|
17
|
+
subject { node.name }
|
18
|
+
it { should == name }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#parent" do
|
22
|
+
subject { node.parent }
|
23
|
+
it { should == parent }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#to_param" do
|
27
|
+
subject { node.to_param }
|
28
|
+
|
29
|
+
context "converts to lowercase" do
|
30
|
+
let(:name) { 'FOOBAR' }
|
31
|
+
it { should == 'foobar' }
|
32
|
+
end
|
33
|
+
|
34
|
+
context "name has spaces" do
|
35
|
+
let(:name) { 'Herp Derp' }
|
36
|
+
it { should == 'herp-derp' }
|
37
|
+
end
|
38
|
+
|
39
|
+
context "name has slashes" do
|
40
|
+
let(:name) { 'Herp \/// Derp' }
|
41
|
+
it { should == 'herp-derp' }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#to_path" do
|
46
|
+
subject { node.to_path }
|
47
|
+
let(:parent) { double(Kayessess::Node, parent: parent1) }
|
48
|
+
let(:parent1) { double(Kayessess::Node, parent: nil) }
|
49
|
+
|
50
|
+
before {
|
51
|
+
parent.should_receive(:to_param) { 'velociraptor' }
|
52
|
+
parent1.should_not_receive(:to_param) { 'decepticon' }
|
53
|
+
}
|
54
|
+
|
55
|
+
it "returns a path that is relative to the styleguide root" do
|
56
|
+
expect(subject).to eq('velociraptor/components')
|
57
|
+
end
|
58
|
+
|
59
|
+
it "excludes the root path from the path" do
|
60
|
+
expect(subject).to_not include 'decepticon'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#parents" do
|
65
|
+
subject { node.parents }
|
66
|
+
let(:parent) { double(Kayessess::Node, parent: parent1) }
|
67
|
+
let(:parent1) { double(Kayessess::Node, parent: parent2) }
|
68
|
+
let(:parent2) { double(Kayessess::Node, parent: parent3) }
|
69
|
+
let(:parent3) { double(Kayessess::Node, parent: nil) }
|
70
|
+
|
71
|
+
it "allows for enumeration over parent nodes" do
|
72
|
+
expect(subject.next).to be parent
|
73
|
+
expect(subject.next).to be parent1
|
74
|
+
expect(subject.next).to be parent2
|
75
|
+
expect(subject.next).to be parent3
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#children" do
|
80
|
+
subject { node.children }
|
81
|
+
let(:children_hash) { {dinosaurs: child1, robots: child2} }
|
82
|
+
let(:child1) { double() }
|
83
|
+
let(:child2) { double() }
|
84
|
+
|
85
|
+
it { should == [child1, child2] }
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#sections" do
|
89
|
+
subject { node.sections }
|
90
|
+
let(:sections_hash) { {dinosaurs: section1, robots: section2} }
|
91
|
+
let(:section1) { double() }
|
92
|
+
let(:section2) { double() }
|
93
|
+
|
94
|
+
it { should == [section1, section2] }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#is_section?" do
|
98
|
+
subject { node.is_section? }
|
99
|
+
it { should == false }
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative "../../lib/kayessess"
|
3
|
+
require_relative "../../lib/kayessess/section"
|
4
|
+
|
5
|
+
describe Kayessess::Section do
|
6
|
+
subject(:section) { Kayessess::Section.new(id, name, parent, sub_section) }
|
7
|
+
let(:id) { 'components' }
|
8
|
+
let(:name) { 'Components' }
|
9
|
+
let(:parent) { double(Kayessess::Node) }
|
10
|
+
let(:sub_section) { double(section: 'Foo.Bar.Hello World', filename: '_foobar.scss') }
|
11
|
+
|
12
|
+
describe "#reference" do
|
13
|
+
subject { section.reference }
|
14
|
+
it { should == 'Foo.Bar.Hello World' }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#description" do
|
18
|
+
subject { section.description }
|
19
|
+
let(:sub_section) { double(description: 'Ice cream is **BEST!**') }
|
20
|
+
it { should == "<p>Ice cream is <strong>BEST!</strong></p>\n" }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#modifiers" do
|
24
|
+
subject { section.modifiers }
|
25
|
+
pending
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#filename" do
|
29
|
+
subject { section.filename }
|
30
|
+
it { should == '_foobar.scss' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#example_partial_path" do
|
34
|
+
subject { section.example_partial_path }
|
35
|
+
it { should == "styleguide/examples/foo/bar/hello_world" }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#to_partial_path" do
|
39
|
+
subject { section.to_partial_path }
|
40
|
+
it { should == "section" }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#is_section?" do
|
44
|
+
subject { section.is_section? }
|
45
|
+
it { should == true }
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "../../lib/kayessess/styleguide"
|
2
|
+
|
3
|
+
describe Kayessess::Styleguide do
|
4
|
+
subject(:styleguide) { Kayessess::Styleguide.new(parser) }
|
5
|
+
let(:parser) { double(sections: []) }
|
6
|
+
let(:tree) { double(Kayessess::Tree) }
|
7
|
+
|
8
|
+
describe "#sections" do
|
9
|
+
pending
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#section" do
|
13
|
+
pending
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#to_partial_path" do
|
17
|
+
its(:to_partial_path) { should == "styleguide" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative "../../lib/kayessess/tree"
|
2
|
+
|
3
|
+
describe Kayessess::Tree do
|
4
|
+
subject(:tree) { Kayessess::Tree.new(sections) }
|
5
|
+
let(:section1) { double(Kayessess::Section) }
|
6
|
+
let(:section2) { double(Kayessess::Section) }
|
7
|
+
let(:section3) { double(Kayessess::Section) }
|
8
|
+
let(:sections) do
|
9
|
+
[
|
10
|
+
["Buttons.Primary Button", section1],
|
11
|
+
["Buttons.Secondary Button", section2],
|
12
|
+
["Components.Headers", section3]
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#root_sections" do
|
17
|
+
subject { tree.root_sections }
|
18
|
+
|
19
|
+
it "returns the children of the styleguide root" do
|
20
|
+
expect(subject.length).to be 2
|
21
|
+
expect(subject[0].sections[0].id).to eq "primary-button"
|
22
|
+
expect(subject[0].sections[1].id).to eq "secondary-button"
|
23
|
+
expect(subject[1].sections[0].id).to eq "headers"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#node_for_path" do
|
28
|
+
subject { tree.node_for_path(section_path) }
|
29
|
+
|
30
|
+
context "when the path exists" do
|
31
|
+
context "for a child node" do
|
32
|
+
let(:section_path) { "Buttons".split('.') }
|
33
|
+
|
34
|
+
it "returns the node that matches the path passed in" do
|
35
|
+
expect(subject.id).to eq "buttons"
|
36
|
+
expect(subject.parent.id).to eq :root
|
37
|
+
expect(subject.children).to eq []
|
38
|
+
expect(subject.sections.map(&:id)).to include "primary-button"
|
39
|
+
expect(subject.sections.map(&:id)).to include "secondary-button"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "for a styleguide section" do
|
44
|
+
let(:section_path) { "Buttons.Primary Button".split('.') }
|
45
|
+
|
46
|
+
it "returns the node that matches the path passed in" do
|
47
|
+
expect(subject.id).to eq "primary-button"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "when the section does not exist" do
|
53
|
+
let(:section_path) { ["buttons", "herp", "derp"] }
|
54
|
+
|
55
|
+
it "throws an error if the path isn't found" do
|
56
|
+
expect { subject }.to raise_error Kayessess::SectionNotFound
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
ENV['RAILS_ENV'] ||= 'test'
|
2
|
+
|
3
|
+
if ENV['COVERAGE']
|
4
|
+
require_relative 'use_coveralls' if ENV['TRAVIS']
|
5
|
+
require_relative 'use_simplecov' unless ENV['TRAVIS']
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'bundler/setup'
|
9
|
+
require 'combustion'
|
10
|
+
require 'rails'
|
11
|
+
require 'kayessess'
|
12
|
+
|
13
|
+
Combustion.initialize! :action_controller, :action_view, :sprockets
|
14
|
+
|
15
|
+
require 'rspec/rails'
|
16
|
+
require 'rspec/autorun'
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.order = "random"
|
20
|
+
end
|