Permalink
Browse files

* use bundler

* upgrade rspec
* get rid of sinatra + tilt integration (it is integrated into tilt)
  • Loading branch information...
1 parent f6ea14e commit 64af36cfc81dc845aa0bbf9ebc5a01cbdc4f29bc @smtlaissezfaire smtlaissezfaire committed Dec 17, 2013
File renamed without changes.
View
@@ -0,0 +1,9 @@
+source 'https://rubygems.org'
+
+gem 'builder'
+
+group :test do
+ gem 'rake'
+ gem 'garlic'
+ gem 'rspec'
+end
View
@@ -0,0 +1,24 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ builder (3.2.2)
+ diff-lcs (1.2.5)
+ garlic (0.1.10)
+ rake (10.1.0)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.7)
+ rspec-expectations (2.14.4)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.4)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ builder
+ garlic
+ rake
+ rspec
View
@@ -61,8 +61,6 @@ Or, you could try config.gem, but that's now known as a bad idea.
== Using Markaby with Sinatra (1.0+)
- require 'markaby/sinatra'
-
get '/foo' do
mab :my_template # my_template.mab in the sinatra view path
end
View
@@ -1,18 +0,0 @@
-require 'markaby/tilt'
-require 'sinatra'
-
-module Sinatra
- class Base
- # sinatra's #render looks for options in Sinatra::Application
- # by asking if it responds_to?(:mab)
- # Unfortunately, if the the mab kernel method is included,
- # Sinatra::Application will respond_to? it.
- set :mab, {}
- end
-
- module Templates
- def mab(template, options={}, locals={})
- render :mab, template, options, locals
- end
- end
-end
View
@@ -1,8 +0,0 @@
-require 'markaby'
-require 'tilt'
-
-module Markaby
- module Tilt
- Template = ::Tilt::MarkabyTemplate
- end
-end
@@ -1 +0,0 @@
-text "_why?"
@@ -2,7 +2,7 @@
describe Markaby do
it "can assign helpers after instantiation" do
- helper = mock 'helper', :foo => :bar
+ helper = double 'helper', :foo => :bar
builder = Markaby::Builder.new
builder.helper = helper
@@ -70,7 +70,7 @@ def test_uses_helper_instance_variable
describe Markaby do
it "can assign helpers after instantiation" do
- helper = mock 'helper', :foo => :bar
+ helper = double 'helper', :foo => :bar
builder = Markaby::Builder.new
builder.helper = helper
@@ -1,49 +0,0 @@
-set :views, lambda { File.join(File.dirname(__FILE__), "views") }
-
-get '/empty_action' do
- "hi there"
-end
-
-get '/markaby_template' do
- mab :markaby_template
-end
-
-get '/simple_html' do
- mab :simple_html
-end
-
-get '/variables' do
- mab :variables, {}, :name => "Scott Taylor"
-end
-
-get '/variables_with_locals' do
- mab :variables, :locals => { :name => "Scott Taylor" }
-end
-
-get '/scope_instance_variables' do
- @name = "Scott Taylor"
- mab :variables
-end
-
-template :layout_index do
- 'div.title "Hello World!"'
-end
-
-get "/named_template" do
- mab :layout_index
-end
-
-get "/layout" do
- @display_layout = true
- mab :layout_index
-end
-
-helpers do
- def chunky
- "bacon"
- end
-end
-
-get "/helpers" do
- mab :helpers
-end
@@ -1,67 +0,0 @@
-unless RUNNING_RAILS
- require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
- require 'markaby/sinatra'
- require 'rack/test'
- require File.expand_path(File.dirname(__FILE__) + "/app")
-
- describe "sinatra integration" do
- include Rack::Test::Methods
-
- def app
- @app ||= Sinatra::Application
- end
-
- it "should render an empty" do
- get '/empty_action'
- last_response.should be_ok
- end
-
- it "should render an empty markaby template" do
- get '/markaby_template'
- last_response.should be_ok
- last_response.body.should == ""
- end
-
- it "should render a template with html in it" do
- get '/simple_html'
- last_response.should be_ok
- last_response.body.should == "<ul><li>hi</li><li>there</li></ul>"
- end
-
- it "should be able to pass variables" do
- get '/variables'
- last_response.should be_ok
- last_response.body.should == '<p class="name">Scott Taylor</p>'
- end
-
- it "should be able to pass variables through locals" do
- get '/variables_with_locals'
- last_response.should be_ok
- last_response.body.should == '<p class="name">Scott Taylor</p>'
- end
-
- it "should have scope to instance variables" do
- get '/scope_instance_variables'
- last_response.should be_ok
- last_response.body.should == '<p class="name">Scott Taylor</p>'
- end
-
- it "should be able to use named templates" do
- get "/named_template"
- last_response.should be_ok
- last_response.body.should == '<div class="title">Hello World!</div>'
- end
-
- it "should be able to use a layout with :layout" do
- get '/layout'
- last_response.should be_ok
- last_response.body.should == '<html><div class="title">Hello World!</div></html>'
- end
-
- it "should be able to access helpers in a template" do
- get '/helpers'
- last_response.should be_ok
- last_response.body.should == "<li>bacon</li>"
- end
- end
-end
@@ -1 +0,0 @@
-li chunky
@@ -1,7 +0,0 @@
-if @display_layout
- html do
- yield
- end
-else
- yield
-end
@@ -1,3 +0,0 @@
-p :class => "name" do
- @name
-end
@@ -1,4 +0,0 @@
-ul do
- li "hi"
- li "there"
-end
@@ -1,3 +0,0 @@
-p :class => "name" do
- name
-end
@@ -1 +0,0 @@
-hello from erb!
@@ -1 +0,0 @@
-li foo
@@ -1 +0,0 @@
-text "hello from markaby!"
@@ -1 +0,0 @@
-text "_why?"
@@ -1 +0,0 @@
-text "foo"
@@ -1 +0,0 @@
-li foo
@@ -1,2 +0,0 @@
-text("Hey ")
-yield
View
@@ -1,75 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
-
-module Markaby
- describe Tilt, "templates" do
- before do
- @block = lambda do |t|
- File.read(File.dirname(__FILE__) + "/#{t.file}")
- end
- end
-
- it "should have the constant ::Tilt::Markaby after registration" do
- lambda {
- ::Tilt::MarkabyTemplate
- }.should_not raise_error
- end
-
- it "should be able to render an erb template" do
- tilt = ::Tilt::ERBTemplate.new("tilt/erb.erb", &@block)
- tilt.render.should == "hello from erb!"
- end
-
- it "should be able to render a markaby template with static html" do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/markaby.mab", &@block)
- tilt.render.should == "hello from markaby!"
- end
-
- it "should use the contents of the template" do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/markaby_other_static.mab", &@block)
- tilt.render.should == "_why?"
- end
-
- it "should render from a string (given as data)" do
- tilt = ::Tilt::MarkabyTemplate.new { "html do; end" }
- tilt.render.should == "<html></html>"
- end
-
- it "should evaluate a template file in the scope given" do
- scope = mock 'scope object', :foo => "bar"
-
- tilt = ::Tilt::MarkabyTemplate.new("tilt/scope.mab", &@block)
- tilt.render(scope).should == "<li>bar</li>"
- end
-
- it "should pass locals to the template" do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/locals.mab", &@block)
- tilt.render(Object.new, { :foo => "bar" }).should == "<li>bar</li>"
- end
-
- it "should yield to the block given" do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/yielding.mab", &@block)
- eval_scope = Markaby::Builder.new
-
- output = tilt.render(Object.new, {}) do
- text("Joe")
- end
-
- output.should == "Hey Joe"
- end
-
- it "should be able to render two templates in a row" do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/render_twice.mab", &@block)
-
- tilt.render.should == "foo"
- tilt.render.should == "foo"
- end
-
- it "should retrieve a Tilt::MarkabyTemplate when calling Tilt['hello.mab']" do
- ::Tilt['./tilt/markaby.mab'].should == Markaby::Tilt::Template
- end
-
- it "should return a new instance of the implementation class (when calling Tilt.new)" do
- ::Tilt.new(File.dirname(__FILE__) + "/tilt/markaby.mab").should be_a_kind_of(Markaby::Tilt::Template)
- end
- end
-end
View
@@ -1,5 +1,4 @@
require 'test/unit'
-require 'test/unit/autorunner'
require 'rspec'
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -9,7 +8,6 @@
require 'markaby/rails'
require 'erb'
-require 'markaby/rails/spec_helper'
module MarkabyTestHelpers
def link_to(obj)

0 comments on commit 64af36c

Please sign in to comment.