Skip to content

Commit 6a3d764

Browse files
committed
setting up spec env
1 parent acd4dfb commit 6a3d764

File tree

9 files changed

+146
-37
lines changed

9 files changed

+146
-37
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
- `type.eql?("Convert 2 SCSS")`
55
Stupid mistake, now it can convert properly to scss
66
- added VERSION and CHANGELOG
7+
8+
## 0.1.1 (Jun 21, 2011)
9+
10+
- Added spec dir for hopefully better testing.

Gemfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
source :gemcutter
22

3-
gem 'thin'
43
gem 'sinatra'
54
gem 'hpricot'
65
gem 'haml'
@@ -11,3 +10,19 @@ gem 'erubis'
1110
gem 'ruby_parser'
1211
gem 'rack-flash'
1312
gem 'sinatra-redirect-with-flash'
13+
14+
group :development, :test do
15+
gem 'rspec'
16+
gem 'webrat'
17+
gem 'rspec-core'
18+
gem 'rspec-instafail'
19+
gem 'rack-test'
20+
gem 'awesome_print'
21+
gem 'ruby-debug19'
22+
gem 'libnotify'
23+
gem 'guard-rspec'
24+
gem 'guard-bundler'
25+
gem 'rb-inotify'
26+
gem 'shotgun'
27+
gem 'heroku'
28+
end

Gemfile.lock

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,109 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4+
archive-tar-minitar (0.5.2)
5+
awesome_print (0.4.0)
46
builder (3.0.0)
5-
daemons (1.1.4)
7+
columnize (0.3.3)
8+
configuration (1.3.1)
9+
diff-lcs (1.1.2)
610
erubis (2.7.0)
7-
eventmachine (0.12.10)
11+
ffi (1.0.9)
12+
guard (0.4.2)
13+
thor (~> 0.14.6)
14+
guard-bundler (0.1.3)
15+
bundler (>= 1.0.0)
16+
guard (>= 0.2.2)
17+
guard-rspec (0.4.0)
18+
guard (>= 0.4.0)
819
haml (3.1.2)
20+
heroku (2.3.3)
21+
launchy (>= 0.3.2)
22+
rest-client (~> 1.6.1)
23+
term-ansicolor (~> 1.0.5)
924
hpricot (0.8.4)
1025
json (1.5.3)
26+
launchy (0.4.0)
27+
configuration (>= 0.0.5)
28+
rake (>= 0.8.1)
29+
libnotify (0.5.6)
30+
linecache19 (0.5.12)
31+
ruby_core_source (>= 0.1.4)
32+
mime-types (1.16)
33+
nokogiri (1.4.6)
1134
rack (1.3.0)
1235
rack-flash (0.1.1)
1336
rack
37+
rack-test (0.6.0)
38+
rack (>= 1.0)
39+
rake (0.9.2)
40+
rb-inotify (0.8.5)
41+
ffi (>= 0.5.0)
42+
rest-client (1.6.3)
43+
mime-types (>= 1.16)
44+
rspec (2.6.0)
45+
rspec-core (~> 2.6.0)
46+
rspec-expectations (~> 2.6.0)
47+
rspec-mocks (~> 2.6.0)
48+
rspec-core (2.6.4)
49+
rspec-expectations (2.6.0)
50+
diff-lcs (~> 1.1.2)
51+
rspec-instafail (0.1.8)
52+
rspec-mocks (2.6.0)
53+
ruby-debug-base19 (0.11.25)
54+
columnize (>= 0.3.1)
55+
linecache19 (>= 0.5.11)
56+
ruby_core_source (>= 0.1.4)
57+
ruby-debug19 (0.11.6)
58+
columnize (>= 0.3.1)
59+
linecache19 (>= 0.5.11)
60+
ruby-debug-base19 (>= 0.11.19)
61+
ruby_core_source (0.1.5)
62+
archive-tar-minitar (>= 0.5.2)
1463
ruby_parser (2.0.6)
1564
sexp_processor (~> 3.0)
1665
sass (3.1.3)
1766
sexp_processor (3.0.5)
67+
shotgun (0.9)
68+
rack (>= 1.0)
1869
sinatra (1.2.6)
1970
rack (~> 1.1)
2071
tilt (< 2.0, >= 1.2.2)
2172
sinatra-redirect-with-flash (0.1.2)
2273
rack-flash (>= 0.1.1)
2374
sinatra (>= 0.9.1)
24-
thin (1.2.11)
25-
daemons (>= 1.0.9)
26-
eventmachine (>= 0.12.6)
27-
rack (>= 1.0.0)
75+
term-ansicolor (1.0.5)
76+
thor (0.14.6)
2877
tilt (1.3.2)
78+
webrat (0.7.3)
79+
nokogiri (>= 1.2.0)
80+
rack (>= 1.0)
81+
rack-test (>= 0.5.3)
2982

3083
PLATFORMS
3184
ruby
3285

3386
DEPENDENCIES
87+
awesome_print
3488
builder
3589
erubis
90+
guard-bundler
91+
guard-rspec
3692
haml
93+
heroku
3794
hpricot
3895
json
96+
libnotify
3997
rack-flash
98+
rack-test
99+
rb-inotify
100+
rspec
101+
rspec-core
102+
rspec-instafail
103+
ruby-debug19
40104
ruby_parser
41105
sass
106+
shotgun
42107
sinatra
43108
sinatra-redirect-with-flash
44-
thin
109+
webrat

Guardfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# A sample Guardfile
2+
# More info at https://github.com/guard/guard#readme
3+
guard 'bundler' do
4+
watch('Gemfile')
5+
end
6+
7+
guard 'rspec', :version => 2, :cli => '-r rspec/instafail -f RSpec::Instafail' do
8+
watch(%r{^spec/.+_spec\.rb})
9+
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
10+
watch('spec/spec_helper.rb') { "spec" }
11+
end

css2sass.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class Css2sass < Sinatra::Base
1111
set :show_exceptions, true if development?
1212
set :raise_errors, false
1313

14+
def self.testing_string
15+
puts "testing string"
16+
end
17+
1418
helpers do
1519
include Rack::Utils
1620
alias_method :h, :escape_html

css2sass_spec.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

spec/css2sass_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'spec_helper'
2+
3+
describe Css2sass do
4+
5+
context 'the API' do
6+
it "speak json" do
7+
post '/json', { :page => { :css => ".content-navigation { border-color: #3bbfce; color: #2b9eab; }" } }
8+
last_response.should be_ok
9+
last_response.body.should == '{"page":{"css":".content-navigation { border-color: #3bbfce; color: #2b9eab; }","sass":".content-navigation\n border-color: #3bbfce\n color: #2b9eab\n"}}'
10+
end
11+
12+
it "speak XML" do
13+
post '/xml', { :page => { :css => ".content-navigation { border-color: #3bbfce; color: #2b9eab; }" } }
14+
last_response.should be_ok
15+
last_response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<page>\n <css>\n <![CDATA[.content-navigation { border-color: #3bbfce; color: #2b9eab; }]]>\n </css>\n <sass>\n <![CDATA[.content-navigation\n border-color: #3bbfce\n color: #2b9eab\n]]>\n </sass>\n</page>\n"
16+
end
17+
18+
end
19+
end

spec/spec.opts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--colour
2+
--format progress
3+
--loadby mtime
4+
--reverse

spec/spec_helper.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require File.dirname(__FILE__) + '/../css2sass'
2+
require 'bundler'
3+
Bundler.require
4+
require 'rack/test'
5+
require 'rspec'
6+
7+
# set test environment
8+
set :environment, :test
9+
10+
RSpec.configure do |conf|
11+
conf.include Rack::Test::Methods
12+
end
13+
14+
def app
15+
@app ||= Sinatra::Application
16+
end

0 commit comments

Comments
 (0)