Permalink
Browse files

Proof of concept commit.

  • Loading branch information...
0 parents commit b2a70832149cf4c4b67dbb3c6880372c44503a70 Winston Teo committed with Winston Teo Mar 15, 2012
Showing with 97 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 Gemfile
  3. +14 −0 Gemfile.lock
  4. +1 −0 Rakefile
  5. +21 −0 cactus.gemspec
  6. +5 −0 lib/cactus.rb
  7. +13 −0 lib/cactus/rails/engine.rb
  8. +17 −0 lib/cactus/rails/helpers/view_helper.rb
  9. +3 −0 lib/cactus/version.rb
  10. +15 −0 vendor/assets/javascripts/cactus.js
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+pkg/*
+.idea
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in cactus.gemspec
+gemspec
@@ -0,0 +1,14 @@
+PATH
+ remote: .
+ specs:
+ cactus (0.0.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ cactus!
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+
+require "cactus/version"
+
+Gem::Specification.new do |s|
+ s.name = "cactus"
+ s.version = Cactus::VERSION
+ s.authors = ["Winston Teo Yong Wei"]
+ s.email = ["winston@newcontext.com"]
+ s.homepage = ""
+ s.summary = %q{CSS BDD framework}
+ s.description = %q{Test your CSS}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ # s.add_development_dependency "rspec"
+end
@@ -0,0 +1,5 @@
+require "cactus/version"
+
+# Rails Helper
+lib_path = File.dirname(__FILE__)
+require "#{lib_path}/cactus/rails/engine.rb" if defined?(Rails)
@@ -0,0 +1,13 @@
+require "#{File.dirname(__FILE__)}/helpers/view_helper"
+
+module Cactus
+ module Rails
+ class Engine < ::Rails::Engine
+ initializer "cactus" do
+ ActiveSupport.on_load(:action_controller) do
+ include Cactus::Rails::ViewHelper
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,17 @@
+module Cactus
+ module Rails
+ module ViewHelper
+ extend ActiveSupport::Concern
+
+ included do
+ helper_method "cactus"
+ end
+
+ def cactus
+ html = "<script src='/assets/cactus.js' type='text/javascript'></script>"
+ html += "<script src='/cactus_specs/spec.js' type='text/javascript'></script>"
+ html.html_safe
+ end
+ end
+ end
+end
@@ -0,0 +1,3 @@
+module Cactus
+ VERSION = "0.0.2"
+end
@@ -0,0 +1,15 @@
+var cactus = {};
+
+cactus.ensure = function(dom, att) {
+ var dom = dom;
+ var att = att;
+ var css = $(dom).css(att);
+
+ return {
+ toEqual: function(expected) {
+ if(css !== expected) {
+ console.log("Expected " + dom + ":" + att + " to equal " + expected + " but got " + css + " instead." );
+ }
+ }
+ }
+};

0 comments on commit b2a7083

Please sign in to comment.