Sha256: db61045a9ff2a615a3645da8dc7a02d8b5dda1b284cd54f4820d877db0c30b19
Contents?: true
Size: 763 Bytes
Versions: 12
Compression:
Stored size: 763 Bytes
Contents
require 'nokogiri' module Ruhl module Rspec module Sinatra def self.included(parent) ruby = <<-RUBY before do origin = "#{caller[0].split(':').first}" f = origin.sub(/\\/spec\\//,'/app/') f = f.sub('_spec.rb','') @view_nodes = Nokogiri::HTML.fragment(File.read(f)) end def ruhl_view @view_nodes end def data_ruhl(path) tag = ruhl_view.css(path).first unless tag raise Spec::Matchers::MatcherError.new("CSS selector: "+ path + " not found") end tag.attribute('data-ruhl').to_s end RUBY parent.class_eval ruby end end end end
Version data entries
12 entries across 12 versions & 1 rubygems