sassunit 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/bin/sassunit +5 -0
- data/lib/sassunit.rb +40 -0
- data/lib/sassunit/backtrace_filter.rb +7 -0
- data/lib/sassunit/cli.rb +33 -0
- data/lib/sassunit/info.rb +5 -0
- data/sassunit.gemspec +25 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a689b7861a9c1b13c61b987228a319ede2753854
|
4
|
+
data.tar.gz: f55026fef9237edbe7bb3c476b040197ebdc9fab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41f13f413d5e563a6fa312d54a9b863b7ebcdf42df748a92d971003e8ea60be03a7e1d3abac6872e3e41b446d219831cace18137c9924abd85163d45afb449b1
|
7
|
+
data.tar.gz: e088248ade5677cb7a2d0f2e6409dab201e577a1a8735251cfccd333093c96cdd048e67dc2a3d8836ef35ad1334029b77f945ea27e72078e089bf4ac986af81c
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Alyssa Ross
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# SassUnit
|
2
|
+
|
3
|
+
A tiny Ruby utility for testing Sass libraries by comparing compiled output of short Sass tests to the expected CSS output.
|
4
|
+
|
5
|
+
For more information about the motivation and rationale behind SassUnit, read my [introductory article](http://alyssa.is/testing-sass), but, in short:
|
6
|
+
|
7
|
+
* Prevents old functionality being accidentally broken by new changes
|
8
|
+
* Easy to learn and use
|
9
|
+
* Can enforce testing with minimum supported version of Sass for your project
|
10
|
+
* Easy to use with continuous integration
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'sassunit'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install sassunit
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
In your project’s root directory, create a folder called “test”. This is where your Sass test files live. Create a Sass file (classic Sass or SCSS) for each test, and for each Sass test file create a corresponding expected output file with the same name, but the “.css” extension.
|
31
|
+
|
32
|
+
### Examples
|
33
|
+
|
34
|
+
```sh
|
35
|
+
# run the tests for the current project directory
|
36
|
+
$ bundle exec sassunit
|
37
|
+
|
38
|
+
# run a single test in the current project
|
39
|
+
$ bundle exec sassunit test/first_test.scss
|
40
|
+
|
41
|
+
# run tests for another project
|
42
|
+
$ bundle exec sassunit ~/projects/another_project # do not include /test
|
43
|
+
```
|
44
|
+
|
45
|
+
Running SassUnit using `bundle exec` will ensure it uses the version of Sass defined in your project’s Gemfile. This can be useful for ensuring that tests still pass with the minimum supported Sass version for your project.
|
46
|
+
|
47
|
+
## Projects using SassUnit
|
48
|
+
|
49
|
+
My [Sass-Web-Fonts](https://github.com/alyssais/Sass-Web-Fonts) library has a comprehensive test suite using SassUnit. If you have a project using SassUnit you should [submit a pull request](https://github.com/alyssais/SassUnit/edit/master/README.md) and I'll probably add it here.
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. [Fork it](https://github.com/alyssais/sassunit/fork)
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/sassunit
ADDED
data/lib/sassunit.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "sass"
|
2
|
+
require "minitest/spec"
|
3
|
+
require "sassunit/backtrace_filter"
|
4
|
+
|
5
|
+
MiniTest.backtrace_filter = SassUnit::BacktraceFilter.new
|
6
|
+
|
7
|
+
module SassUnit
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def add_test(directory = ".", files = nil)
|
11
|
+
Sass.load_paths << directory
|
12
|
+
|
13
|
+
files ||= Dir.glob("#{directory}/test/**/*.s{a,c}ss")
|
14
|
+
files.each do |file|
|
15
|
+
|
16
|
+
describe file do
|
17
|
+
it "compiles correctly" do
|
18
|
+
expected_file = file.sub(/\.s[ac]ss/, ".css")
|
19
|
+
|
20
|
+
files_exist = [file, expected_file].inject(true) do |acc, file|
|
21
|
+
acc && File.exists?(file)
|
22
|
+
end
|
23
|
+
|
24
|
+
return assert false, "expected files do not exist" unless files_exist
|
25
|
+
|
26
|
+
opts = { filename: file, style: :compressed }
|
27
|
+
compiled = Sass.compile(open(file).read, opts)
|
28
|
+
# compile the CSS file as SCSS so it's formatted the same
|
29
|
+
expected = Sass.compile(open(expected_file).read, opts)
|
30
|
+
compiled.must_equal expected
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_tests
|
38
|
+
MiniTest.run
|
39
|
+
end
|
40
|
+
end
|
data/lib/sassunit/cli.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "sassunit/info"
|
2
|
+
require "commander"
|
3
|
+
|
4
|
+
module SassUnit
|
5
|
+
class CLI
|
6
|
+
include Commander::Methods
|
7
|
+
|
8
|
+
def run
|
9
|
+
program :name, SassUnit::NAME
|
10
|
+
program :version, SassUnit::VERSION
|
11
|
+
program :description, SassUnit::DESCRIPTION
|
12
|
+
|
13
|
+
command :test do |c|
|
14
|
+
c.description = "Tests specified Sass files"
|
15
|
+
c.action do |args, options|
|
16
|
+
require "sassunit"
|
17
|
+
args[0] ||= "."
|
18
|
+
args.each do |path|
|
19
|
+
if Pathname.new(path).directory?
|
20
|
+
SassUnit.add_test(path)
|
21
|
+
else
|
22
|
+
SassUnit.add_test(nil, [path])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
SassUnit.run_tests
|
26
|
+
end
|
27
|
+
end
|
28
|
+
default_command :test
|
29
|
+
|
30
|
+
run!
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/sassunit.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sassunit/info'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = SassUnit::NAME
|
8
|
+
spec.version = SassUnit::VERSION
|
9
|
+
spec.authors = ["Alyssa Ross"]
|
10
|
+
spec.email = ["hi@alyssa.is"]
|
11
|
+
spec.summary = SassUnit::DESCRIPTION
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "sass"
|
21
|
+
spec.add_dependency "commander"
|
22
|
+
spec.add_dependency "minitest"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sassunit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alyssa Ross
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: commander
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- hi@alyssa.is
|
86
|
+
executables:
|
87
|
+
- sassunit
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- CODE_OF_CONDUCT.md
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/sassunit
|
98
|
+
- lib/sassunit.rb
|
99
|
+
- lib/sassunit/backtrace_filter.rb
|
100
|
+
- lib/sassunit/cli.rb
|
101
|
+
- lib/sassunit/info.rb
|
102
|
+
- sassunit.gemspec
|
103
|
+
homepage: ''
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.2.5
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: A tiny Sass unit testing library.
|
127
|
+
test_files: []
|