css_lint 0.9.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/vendor/js.jar ADDED
Binary file
@@ -0,0 +1,107 @@
1
+ require 'spec_helper'
2
+
3
+ describe CSSLint do
4
+ describe "Lint" do
5
+ describe "#new" do
6
+ context "it is provided a valid argument" do
7
+ before(:each) do
8
+ File.stub!(:join).and_return('/some_fake_dir')
9
+ @cl = CSSLint::Lint.new 'foo'
10
+ end
11
+
12
+ it "creates an instance of CSSLint::Lint if it's passed an argument" do
13
+ @cl.instance_of?(CSSLint::Lint).should == true
14
+ end
15
+
16
+ it "sets the value of :css to an array of css sources passed to the csslint command, relative to the current working directory" do
17
+ @cl.css.class == Array
18
+ @cl.css.should == ['foo']
19
+ end
20
+
21
+ it "sets the value of :gem_vendor_dir" do
22
+ @cl.gem_vendor_dir.should == '/some_fake_dir'
23
+ end
24
+ end
25
+
26
+ context "it is not provided a valid argument" do
27
+ before(:each) do
28
+ @cl = CSSLint::Lint.new
29
+ end
30
+
31
+ it "does not fail if no argument is provided" do
32
+ @cl.instance_of?(CSSLint::Lint).should == true
33
+ end
34
+
35
+ it "sets the value of :css to the value of the error_message method" do
36
+ @cl.css.should == @cl.error_message
37
+ end
38
+ end
39
+ end
40
+
41
+ describe "#error_message" do
42
+ it "returns the string 'Must provide css_lint a CSS file or directory'" do
43
+ @cl = CSSLint::Lint.new
44
+ @cl.error_message.should == "Must provide css_lint a CSS file or directory"
45
+ end
46
+ end
47
+
48
+ describe "#execute" do
49
+ context "Lint is not instantiated with a valid argument" do
50
+ it "prints the value of :css, which should be the value of error_message" do
51
+ @cl = CSSLint::Lint.new
52
+ $stdout.should_receive(:puts).with(@cl.error_message)
53
+ @cl.execute
54
+ end
55
+ end
56
+
57
+ context "Lint is instantiated with a valid argument" do
58
+ it "calls run_lint" do
59
+ @cl = CSSLint::Lint.new 'foo'
60
+ @cl.stub!(:run_lint)
61
+ @cl.should_receive(:run_lint)
62
+ @cl.execute
63
+ end
64
+ end
65
+ end
66
+
67
+ describe "#get_java_path" do
68
+ it "calls system(which java)" do
69
+ @cl = CSSLint::Lint.new 'foo'
70
+ @cl.should_receive(:'`').with("which java")
71
+ @cl.get_java_path
72
+ end
73
+ end
74
+
75
+ describe "#run_lint" do
76
+ context "the user does not have java installed" do
77
+ it "raises 'You do not have a Java installed, but it is required.'" do
78
+ @cl = CSSLint::Lint.new 'foo'
79
+ @cl.stub!(:get_java_path).and_return(false)
80
+ @cl.should_receive(:get_java_path)
81
+ lambda{@cl.run_lint}.should raise_exception
82
+ end
83
+ end
84
+
85
+ context "the user has java installed" do
86
+ it "lints the value of :css" do
87
+ File.stub!(:join).and_return('/fake_vendor_dir')
88
+ @cl = CSSLint::Lint.new 'foo'
89
+ @cl.stub!(:get_java_path).and_return('java installed')
90
+ @cl.should_receive(:get_java_path)
91
+ @cl.should_receive("system").with("java -jar /fake_vendor_dir/js.jar /fake_vendor_dir/csslint-rhino.js $@ foo")
92
+ @cl.run_lint
93
+ end
94
+
95
+ it "Executes the command to return the version of CSS Lint if --version is passed as an option" do
96
+ File.stub!(:join).and_return('/fake_vendor_dir')
97
+ @cl = CSSLint::Lint.new '--version'
98
+ @cl.stub!(:get_java_path).and_return('java installed')
99
+ @cl.should_receive(:get_java_path)
100
+ @cl.should_receive("system").with("java -jar /fake_vendor_dir/js.jar /fake_vendor_dir/csslint-rhino.js $@ --version ")
101
+ @cl.execute('--version')
102
+ end
103
+
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+
6
+ require_relative '../lib/css_lint'
7
+
8
+ RSpec.configure do |config|
9
+ # some (optional) config here
10
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: css_lint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.9.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mike Ball
9
+ - John Riviello
10
+ - Jen Valure
11
+ - Mike Rottina
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2012-10-14 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rspec
19
+ requirement: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - '='
23
+ - !ruby/object:Gem::Version
24
+ version: '2.4'
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - '='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.4'
33
+ - !ruby/object:Gem::Dependency
34
+ name: simplecov
35
+ requirement: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ description: Lint your CSS.
50
+ email:
51
+ executables:
52
+ - css_lint
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - lib/css_lint.rb
57
+ - lib/vendor/csslint-rhino.js
58
+ - lib/vendor/js.jar
59
+ - spec/lib/css_lint_spec.rb
60
+ - spec/spec_helper.rb
61
+ - bin/css_lint
62
+ homepage: http://github.com/comcast
63
+ licenses: []
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 1.8.24
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Nicholas C. Zakas and Nicole Sullivan's CSS Lint available as a Gem.
86
+ test_files:
87
+ - spec/lib/css_lint_spec.rb
88
+ - spec/spec_helper.rb