Sha256: 93d92890702a88af0e425b846a94db62cbbce2f893f2392411f0c1a58dc74559
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
require 'active_support' require 'fileutils' Given /^our impartials are stored in "([^"]*)"$/ do |location| @location = location Impartial.configure do |config| config.paths = [location] end end Given /^our impartials are stored in "([^"]*)" or "([^"]*)"$/ do |location1, location2| @location = location2 Impartial.configure do |config| config.paths = [location1, location2] end end Given /^an impartial named "([^"]*)"$/ do |name| @name = name.underscore @shortname = name.demodulize.underscore FileUtils.mkdir_p File.join(@location || 'impartials', @name) path = File.join(@location || 'impartials', @name, "#{@name}.rb") File.open path, "w" do |f| f.puts <<-FILE require 'impartial' class #{@name.camelize} < Impartial::Base end FILE end end Given /^it has a handlebars template$/ do path = File.join(@location || 'impartials', @name, "#{@name}.html.hbs") File.open path, "w" do |f| f.puts <<-FILE <html> <body> <div class="#{@name.camelize.gsub('::', '-')}">Hello World!</div> </body> </html> FILE end end Given /^it has a LESS stylesheet$/ do path = File.join(@location || 'impartials', @name, "#{@name}.css.less") File.open path, "w" do |f| f.puts <<-FILE .#{@name.camelize.gsub('::', '-')} { text-shadow: 0px -2px 0px #333, 0px 2px 3px #666; } FILE end end Then /^I can render the impartial to a string$/ do path = File.join('.', @location || 'impartials', @name, @shortname) require path Impartial.render(@shortname).to_s.should eql <<-STRING <html> <body> <div class="#{@name.camelize.gsub('::', '-')}">Hello World!</div> </body> </html> STRING end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
impartial-0.0.1 | features/steps/render_impartial_view_steps.rb |