-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
97 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Gemfile.lock | ||
pkg/* |
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,3 @@ | ||
--colour | ||
--format documentation | ||
--fail-fast |
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,2 +1,7 @@ | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks | ||
|
||
require "rspec/core/rake_task" | ||
RSpec::Core::RakeTask.new(:spec) do |spec| | ||
spec.pattern = 'spec/**/*_spec.rb' | ||
end |
Empty file.
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,4 +1,4 @@ | ||
require 'active_support' | ||
require 'active_support/core_ext/string' | ||
|
||
module RailsTemplater | ||
extend self | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Foo Bar |
Empty file.
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,47 @@ | ||
require 'spec_helper' | ||
|
||
describe RailsTemplater::Templater do | ||
|
||
let(:group) { 'sample' } | ||
|
||
it "generates a recipe path based on a name" do | ||
subject.recipe("mongoid").should == File.expand_path('recipes/mongoid.rb', TEMPLATE_FRAMEWORK_PATH) | ||
end | ||
|
||
it "generates a snippet path" do | ||
subject.snippet_path("cucumber").should == File.expand_path('snippets/cucumber', TEMPLATE_FRAMEWORK_PATH) | ||
end | ||
|
||
it "generates a template path" do | ||
subject.template_path("haml").should == File.expand_path('templates/haml', TEMPLATE_FRAMEWORK_PATH) | ||
end | ||
|
||
describe "#load_snippet" do | ||
|
||
let(:snippet_name) { 'sample_snippet' } | ||
|
||
before(:each) do | ||
subject.stub(:snippet_path) { FIXTURE_PATH } | ||
end | ||
|
||
it "loads a snippet" do | ||
subject.load_snippet(snippet_name, group).should == load_fixture(snippet_name) | ||
end | ||
|
||
end | ||
|
||
describe "#load_template" do | ||
|
||
let(:template_name) { 'sample_template.rb' } | ||
|
||
before(:each) do | ||
subject.stub(:template_path) { FIXTURE_PATH } | ||
end | ||
|
||
it "loads a template" do | ||
subject.load_template(template_name, group).should == load_fixture(template_name) | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'spec_helper' | ||
|
||
describe RailsTemplater do | ||
|
||
subject { RailsTemplater } | ||
|
||
its(:template_runner) { should == File.expand_path('template_runner.rb', TEMPLATE_FRAMEWORK_PATH)} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
begin | ||
require 'bundler' | ||
Bundler.setup(:default, :development) | ||
rescue LoadError => e | ||
# Fall back on doing an unlocked resolve at runtime. | ||
STDERR.puts e.message | ||
STDERR.puts "Try running `bundle install`." | ||
exit! | ||
end | ||
|
||
require 'rails_templater' | ||
require 'rspec' | ||
|
||
# # Requires supporting files with custom matchers and macros, etc, | ||
# in ./support/ and its subdirectories. | ||
Dir[File.join(File.dirname(__FILE__),'/support/**/*.rb')].each {|f| require f} | ||
|
||
RSpec.configure do |config| | ||
config.mock_with :rspec | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FIXTURE_PATH = File.join(File.dirname(__FILE__), '..', 'fixtures') | ||
|
||
def load_fixture(name) | ||
File.read File.expand_path(name, FIXTURE_PATH) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TEMPLATE_FRAMEWORK_PATH = File.join(File.dirname(__FILE__), '..', '..','lib', 'template_framework') |