Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New test setup and hopefully a more sane engine initializer.
- Loading branch information
1 parent
189fc68
commit 56ec18d
Showing
20 changed files
with
3,510 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.bundle | ||
Gemfile.lock | ||
pkg/* | ||
log/* | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
source :rubygems | ||
gemspec | ||
|
||
gem 'less-rails', :path => ENV['LESS_RAILS_PATH'] if ENV['LESS_RAILS_PATH'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
guard 'minitest' do | ||
watch(%r|^lib/less/rails/bootstrap/(.*)\.rb|) { |m| "test/cases/#{m[1]}_spec.rb" } | ||
watch(%r|^test/spec_helper\.rb|) { "test/cases" } | ||
watch(%r|^test/cases/(.*)_spec\.rb|) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler' | ||
require 'rake/testtask' | ||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
Rake::TestTask.new do |t| | ||
t.libs = ['lib','test'] | ||
t.test_files = Dir.glob("test/**/*_spec.rb").sort | ||
t.verbose = true | ||
end | ||
|
||
task :default => [:test] | ||
task :spec => [:test] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module Less | ||
module Rails | ||
module Bootstrap | ||
VERSION = "1.3.2" | ||
VERSION = "1.3.3" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
class EngineSpec < Less::Rails::Bootstrap::Spec | ||
|
||
it 'must be able to hook into a less-rails config' do | ||
dummy_config.less.must_be_instance_of ActiveSupport::OrderedOptions | ||
end | ||
|
||
it 'must append engines assets stylesheets to less-rails load paths' do | ||
dummy_config.less.paths.must_be_instance_of Array | ||
dummy_config.less.paths.must_include project_root | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require 'spec_helper' | ||
|
||
class UsageCssSpec < Less::Rails::Bootstrap::Spec | ||
|
||
describe 'application.css' do | ||
|
||
let(:app_css) { dummy_asset('application.css') } | ||
|
||
it 'will render main bootstrap.less file and all included modules' do | ||
app_css.must_include 'Bootstrap @VERSION', 'From boostrap.less' | ||
app_css.must_include 'Forms.less', 'From forms.less' | ||
app_css.must_include 'Snippets of reusable CSS', 'From mixins.less' | ||
app_css.must_include 'Patterns.less', 'From patterns.less' | ||
app_css.must_include 'Scaffolding', 'From scaffolding.less' | ||
app_css.must_include 'Tables.less', 'From tables.less' | ||
app_css.must_include 'Typography.less', 'From type.less' | ||
app_css.must_include 'Variables.less', 'From variables.less' | ||
end | ||
|
||
it 'must include basic css afterward' do | ||
app_css.must_include '#other-css { color: red; }', 'From our code afterward.' | ||
end | ||
|
||
end | ||
|
||
describe 'framework.css.less' do | ||
|
||
before { dummy_config.less.compress = true } | ||
|
||
let(:framework_css) { dummy_asset('framework.css') } | ||
|
||
it 'will render bootstrap functions' do | ||
border_radius_line = line_for_framework_css('framework-border-radius') | ||
border_radius_line.must_include '-webkit-border-radius:4px' | ||
border_radius_line.must_include '-moz-border-radius:4px' | ||
border_radius_line.must_include 'border-radius:4px' | ||
end | ||
|
||
it 'will render bootstrap variables' do | ||
link_color_line = line_for_framework_css('framework-linkColor') | ||
link_color_line.must_include 'color:#0069d6;' | ||
end | ||
|
||
end | ||
|
||
describe 'individual.css.less' do | ||
|
||
before { dummy_config.less.compress = true } | ||
|
||
let(:individual_css) { dummy_asset('individual.css') } | ||
|
||
it 'will render bootstrap variables and mixins' do | ||
my_button_line = line_for_individual_css('individual-my-button') | ||
my_button_line.must_include '-webkit-border-radius:10px' | ||
my_button_line.must_include '-moz-border-radius:10px' | ||
my_button_line.must_include 'border-radius:10px' | ||
end | ||
|
||
end | ||
|
||
|
||
private | ||
|
||
def line_for_framework_css(name) | ||
framework_css.each_line.detect{ |line| line.include? name }.strip | ||
end | ||
|
||
def line_for_individual_css(name) | ||
individual_css.each_line.detect{ |line| line.include? name }.strip | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'spec_helper' | ||
|
||
class UsageJsSpec < Less::Rails::Bootstrap::Spec | ||
|
||
describe 'application.js' do | ||
|
||
let(:app_js) { dummy_asset('application.js') } | ||
|
||
it 'will render main bootstrap.js file and all included modules' do | ||
app_js.must_include 'bootstrap-alerts.js' | ||
app_js.must_include 'bootstrap-dropdown.js' | ||
app_js.must_include 'bootstrap-modal.js' | ||
app_js.must_include 'bootstrap-popover.js' | ||
app_js.must_include 'bootstrap-scrollspy.js' | ||
app_js.must_include 'bootstrap-tabs.js' | ||
app_js.must_include 'bootstrap-twipsy.js' | ||
end | ||
|
||
it 'must include basic js afterward' do | ||
app_js.must_include '$(document).ready(function(){...});' | ||
end | ||
|
||
end | ||
|
||
describe 'individual.css.less' do | ||
|
||
let(:individual_js) { dummy_asset('individual.js') } | ||
|
||
it 'will render bootstrap variables and mixins' do | ||
individual_js.must_include 'bootstrap-modal.js' | ||
end | ||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//= require twitter/bootstrap | ||
|
||
$(document).ready(function(){...}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//= require twitter/bootstrap/modal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
*= require twitter/bootstrap | ||
*/ | ||
|
||
#other-css { color: red; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import "twitter/bootstrap"; | ||
|
||
#framework-start{color:red;} | ||
|
||
#framework-border-radius { .border-radius(4px); } | ||
#framework-linkColor { color: @linkColor; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@import "twitter/bootstrap/variables"; | ||
@import "twitter/bootstrap/mixins"; | ||
|
||
.myButton(@radius: 5px) { | ||
.border-radius(@radius); | ||
} | ||
|
||
#individual-my-button { | ||
.myButton(10px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'sprockets/railtie' | ||
require 'action_controller/railtie' | ||
require 'action_view/railtie' | ||
require 'action_view/base' | ||
require 'action_controller/base' | ||
|
||
module Dummy | ||
class Application < ::Rails::Application | ||
|
||
config.root = File.join __FILE__, '..' | ||
config.active_support.deprecation = :stderr | ||
config.cache_store = :memory_store | ||
config.consider_all_requests_local = true | ||
|
||
config.assets.enabled = true | ||
config.assets.cache_store = config.cache_store | ||
|
||
end | ||
end | ||
|
||
Dummy::Application.initialize! |
Oops, something went wrong.