Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
100% passing specs for essential (missing Xap test though)
- Loading branch information
1 parent
b2b1bd5
commit 1687fc1
Showing
19 changed files
with
267 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
require 'silverline' | ||
require 'patch/ruby' | ||
|
||
require 'silverline' | ||
|
||
require 'silverline/essential' | ||
require 'silverline/visualize' | ||
require 'silverline/teleport' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
module Silverline::Visualize::Helpers; end | ||
|
||
require 'silverline/visualize/helpers/types' | ||
module Silverline::Visualize::Helpers | ||
include Types | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
vendor/plugins/silverline/lib/silverline/visualize/helpers/templates.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
vendor/plugins/silverline/lib/silverline/visualize/helpers/types.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
vendor/plugins/silverline/spec/silverline/essential/essential_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require File.dirname(__FILE__) + "/../../spec_nonrails.rb" | ||
|
||
module Silverline | ||
module Essential | ||
module Html | ||
end | ||
end | ||
end | ||
|
||
module ActionView | ||
class Base | ||
end | ||
end | ||
|
||
describe Silverline::Essential do | ||
|
||
before do | ||
require 'silverline/essential' | ||
end | ||
|
||
it "should define Xap" do | ||
Silverline::Essential::Xap.should_not be_nil | ||
end | ||
|
||
it "should use Chiron for xapping" do | ||
Silverline::Essential::Xap.should == :chiron | ||
end | ||
|
||
it "should mixin essential HTML module into ActionView's Base class" do | ||
ActionView::Base.included_modules.include?(Silverline::Essential::Html) | ||
end | ||
|
||
it "should tell the generator to register itself" do | ||
Silverline::Essential.instance_eval{remove_const :Generator} | ||
gen = Silverline::Essential::Generator = mock("Generator") | ||
gen.should_receive(:register) | ||
load 'silverline/essential.rb' | ||
end | ||
|
||
end |
93 changes: 93 additions & 0 deletions
93
vendor/plugins/silverline/spec/silverline/essential/generator_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
require File.dirname(__FILE__) + '/../../spec_nonrails.rb' | ||
|
||
Silverline.instance_eval{remove_const :Essential} if defined?(Silveline::Essential) | ||
Silverline::Essential = Module.new | ||
|
||
Silverline::Essential.instance_eval{remove_const :Xap} if defined?(Silveline::Essential::Xap) | ||
Silverline::Essential::Xap = :chiron | ||
|
||
load 'silverline/essential/generator.rb' | ||
|
||
describe Silverline::Essential::Generator do | ||
|
||
before do | ||
Silverline::Essential.instance_eval{remove_const :Generator} | ||
Silverline::Essential::Generator = Module.new | ||
end | ||
|
||
before(:each) do | ||
load 'silverline/essential/generator.rb' | ||
|
||
Object.instance_eval{ remove_const :FileUtils} if defined?(FileUtils) | ||
Object.instance_eval{ remove_const :File} if defined?(File) | ||
|
||
@watcher = mock("FileSystemWatcher") | ||
FileSystemWatcher.stub!(:new).and_return @watcher | ||
|
||
@gen = Silverline::Essential::Generator | ||
end | ||
|
||
it "should watch directories to put into XAP" do | ||
FileUtils = mock("FileUtils") | ||
FileUtils.should_receive(:mkdir_p).with(Silverline::TMP_CLIENT) | ||
FileUtils.should_receive(:mkdir_p).with(Silverline::CLIENT_ROOT) | ||
|
||
@watcher.should_receive(:addDirectory).with(Silverline::CLIENT_ROOT) | ||
@watcher.should_receive(:addDirectory).with(Silverline::PLUGIN_CLIENT) | ||
@watcher.should_receive(:addDirectory).with("#{Silverline::PLUGIN_ROOT}/public") | ||
@watcher.should_receive(:addDirectory).with("#{RAILS_ROOT}/public/ironruby") | ||
|
||
#@watcher.should_receive(:addDirectory).with(Silverline::RAILS_CTRLRS) | ||
@watcher.stub!(:addFile) | ||
@watcher.should_receive(:addDirectory).with(Silverline::RAILS_VIEWS) | ||
|
||
@watcher.should_receive(:sleepTime=).with(1) | ||
|
||
@watcher.should_receive(:start) | ||
|
||
@gen.should_receive(:generate) | ||
|
||
@gen.register | ||
end | ||
|
||
it "should delete the XAP" do | ||
File = mock("File") | ||
FileUtils = mock("FileUtils", :null_object => true) | ||
File.stub!(:exists?).with(Silverline::XAP_FILE).and_return true | ||
File.should_receive(:delete).with(Silverline::XAP_FILE).ordered | ||
@gen.generate | ||
end | ||
|
||
it "should not try to delete the XAP" do | ||
File = mock("File") | ||
FileUtils = mock("FileUtils", :null_object => true) | ||
File.stub!(:exists?).with(Silverline::XAP_FILE).and_return false | ||
File.should_not_receive(:delete).with(Silverline::XAP_FILE) | ||
@gen.generate | ||
end | ||
|
||
it "should generate the XAP from the watched folders" do | ||
@xap = mock("XAP") | ||
File = mock("File", :null_object => true) | ||
FileUtils = mock("FileUtils") | ||
|
||
logger.should_receive(:info).with("Silverline: Generating client.xap") | ||
|
||
FileUtils.should_receive(:cp_r).with("#{Silverline::PLUGIN_CLIENT}/.", Silverline::TMP_CLIENT).ordered | ||
|
||
FileUtils.should_receive(:mkdir_p).with("#{Silverline::TMP_CLIENT}/controllers").ordered | ||
FileUtils.should_receive(:mkdir_p).with("#{Silverline::TMP_CLIENT}/views").ordered | ||
FileUtils.should_receive(:cp).with('app/controllers/client_controller.rb', "#{Silverline::TMP_CLIENT}/controllers").ordered | ||
FileUtils.should_receive(:cp_r).with("#{Silverline::RAILS_VIEWS}/.", "#{Silverline::TMP_CLIENT}/views").ordered | ||
|
||
FileUtils.should_receive(:cp_r).with("#{Silverline::CLIENT_ROOT}/.", Silverline::TMP_CLIENT).ordered | ||
|
||
Silverline::Essential::XAP.should_receive(:new).with(Silverline::XAP_FILE, Silverline::TMP_CLIENT).and_return @xap | ||
@xap.should_receive(:generate) | ||
|
||
FileUtils.should_receive(:rm_r).with(Silverline::TMP_CLIENT).ordered | ||
|
||
@gen.generate | ||
end | ||
|
||
end |
Oops, something went wrong.