Sha256: d3607b6c2da94d68c2bb76a2e4ee090570a21aaa56fe4e82bbcb2c044281d4d9

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

# encoding: UTF-8

if ENV["COVERAGE"]
  require "simplecov"
  SimpleCov.start
end

require 'minitest/spec'
require 'minitest/autorun'
require 'minitest/pride'
require 'mocha/setup'

require 'pry'

require 'rails'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'rails/test_unit/railtie'

require 'keynote'

## Initialize our test app (by Jose Valim: https://gist.github.com/1942658)

class TestApp < Rails::Application
  config.active_support.deprecation = :log
  config.eager_load = false

  config.secret_token = 'a' * 100
end

class HelloController < ActionController::Base
  def world
    render :text => "Hello world!", :layout => false
  end
end

TestApp.initialize!

# We have to define this class because it's hard-coded into the definition of
# ActiveSupport::TestCase, which will load regardless of whether we load
# ActiveRecord.
module ActiveRecord
  class Model
  end
end

## Examples

class EmptyPresenter < Keynote::Presenter
end

class NormalPresenter < Keynote::Presenter
  presents :model

  def some_bad_js
    "<script>alert('pwnt');</script>"
  end

  def some_bad_html
    build_html do
      div { text some_bad_js }
      div { some_bad_js }
      div some_bad_js
    end
  end
end

class Normal
end

module Keynote
  class NestedPresenter < Keynote::Presenter
    presents :model

    def generate_div
      build_html do
        div.hi! do
          link_to '#', 'Hello'
        end
      end
    end
  end

  class Nested
  end
end

class CombinedPresenter < Keynote::Presenter
  presents :model_1, :model_2
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keynote-0.2.0 spec/helper.rb