Permalink
Browse files

upadte rspec layout

  • Loading branch information...
1 parent 6068b2c commit 01e3b6d72e05368240782b2ce83f9925a3d545c1 @xiaods xiaods committed Sep 14, 2010
Showing with 39 additions and 42 deletions.
  1. 0 spec/spec.opts → .rspec
  2. +0 −1 Rakefile
  3. +1 −1 install.rb
  4. +1 −1 lib/high_charts_helper.rb
  5. +31 −35 spec/lazy_high_charts_spec.rb
  6. +6 −4 spec/spec_helper.rb
File renamed without changes.
View
@@ -11,5 +11,4 @@ if defined?(RSpec)
RSpec::Core::RakeTask.new('spec') do |t|
t.pattern = FileList['spec/**/*_spec.rb']
end
-
end
View
@@ -1,7 +1,7 @@
# Install hook code here
puts "Copying files..."
dir = "javascripts"
-["excanvas.compiled.js", "highcharts.js"].each do |js_file|
+["highcharts.js"].each do |js_file|
dest_file = File.join(Rails.root, "public", dir, js_file)
src_file = File.join(File.dirname(__FILE__) , dir, js_file)
FileUtils.cp_r(src_file, dest_file)
@@ -9,7 +9,7 @@ def high_chart(placeholder, object , &block)
def high_graph(placeholder, object, &block)
- graph = javascript_tag <<-EOJS
+ graph =<<-EOJS
jQuery(function() {
// 1. Define JSON options
var options = {
@@ -1,6 +1,8 @@
# coding: utf-8
require 'spec_helper'
+require 'pp'
+
describe HighChartsHelper do
include HighChartsHelper
@@ -12,46 +14,40 @@
@options = "options"
end
- describe "high_chart_includes" do
- it "should have a script tag" do
- javascript_include_tag(:high_charts).should have_tag('script')
- end
- end
-
describe "high_chart_helper" do
+ it "should return a div with an id of high_chart object" do
+ hc = HighChart.new("placeholder", :class => 'stylin')
+ high_chart(hc.placeholder, hc).should have_tag('div[id=?][class=?]', hc.placeholder, 'stylin')
+ end
- it "should return a div with an id of high_chart object" do
- hc = HighChart.new("placeholder", :class => 'stylin')
- high_chart(hc.placeholder, hc).should have_tag('div[id=?][class=?]', hc.placeholder, 'stylin')
- end
-
- it "should return a script" do
- hc = HighChart.new("placeholder")
- high_chart(hc.placeholder, hc).should have_tag('script')
- end
+ it "should return a script" do
+ hc = HighChart.new("placeholder")
+ pp hc.inspect
+ high_chart(hc.placeholder, hc).should have_tag('script')
+ end
end
describe "high_chart_graph" do
- describe "ready function" do
- it "should be a javascript script" do
- high_chart(@placeholder, @chart).should have_tag('script[type=?]', 'text/javascript')
- high_chart(@placeholder, @chart).should match(/\}\s*\)\s*;/)
- end
-
- it "should generate generate ready function (no conflict with prototype)" do
- high_chart(@placeholder, @chart).should match(/jQuery\(function\(\)\s*\{/)
- end
- end
- describe "initialize HighChart" do
- it "should set Chart data" do
- high_chart(@placeholder, @chart).should =~ /var\s+chart\s+=\s+new\s+Highcharts.Chart/
- end
-
- it "should set chart renderTo" do
- high_chart(@placeholder, @chart).should match(/chart:\s+{\"renderTo\":\"placeholder\"/)
- end
-
- end
+ describe "ready function" do
+ it "should be a javascript script" do
+ high_chart(@placeholder, @chart).should have_tag('script[type=?]', 'text/javascript')
+ high_chart(@placeholder, @chart).should match(/\}\s*\)\s*;/)
+ end
+
+ it "should generate generate ready function (no conflict with prototype)" do
+ high_chart(@placeholder, @chart).should match(/jQuery\(function\(\)\s*\{/)
+ end
+ end
+ describe "initialize HighChart" do
+ it "should set Chart data" do
+ high_chart(@placeholder, @chart).should match(/var\s+chart\s+=\s+new\s+Highcharts.Chart/)
+ end
+
+ it "should set chart renderTo" do
+ high_chart(@placeholder, @chart).should match(/chart:\s+{\"renderTo\":\"placeholder\"/)
+ end
+
+ end
end
View
@@ -6,6 +6,12 @@
require 'action_controller'
require 'action_mailer'
+require 'rspec'
+
+Rspec.configure do |c|
+ c.mock_with :rspec
+end
+
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/high_chart'))
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/high_charts_helper'))
@@ -21,10 +27,6 @@ module HighChartsHelper
include ActionView::Helpers::CaptureHelper
include ActionView::Helpers::AssetTagHelper
include ActiveSupport
-
end
-
-
-

0 comments on commit 01e3b6d

Please sign in to comment.