ruhl 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/ruhl/rspec/rails.rb +32 -0
- data/lib/ruhl/rspec/sinatra.rb +33 -0
- data/ruhl.gemspec +4 -2
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Ruhl
|
4
|
+
module Rspec
|
5
|
+
module Rails
|
6
|
+
def self.included(parent)
|
7
|
+
|
8
|
+
ruby = <<-RUBY
|
9
|
+
before do
|
10
|
+
f = "#{caller[0].split(':').first}"
|
11
|
+
f = f.sub("\.\/spec","#{::Rails.root}\/app").sub('_spec.rb','')
|
12
|
+
@view_nodes = Nokogiri::HTML.fragment(File.read(f))
|
13
|
+
end
|
14
|
+
|
15
|
+
def ruhl_view
|
16
|
+
@view_nodes
|
17
|
+
end
|
18
|
+
|
19
|
+
def data_ruhl(path)
|
20
|
+
tag = ruhl_view.css(path).first
|
21
|
+
unless tag
|
22
|
+
raise Spec::Matchers::MatcherError.new("CSS selector: "+ path + " not found")
|
23
|
+
end
|
24
|
+
tag.attribute('data-ruhl').to_s
|
25
|
+
end
|
26
|
+
RUBY
|
27
|
+
|
28
|
+
parent.class_eval ruby
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Ruhl
|
4
|
+
module Rspec
|
5
|
+
module Sinatra
|
6
|
+
def self.included(parent)
|
7
|
+
|
8
|
+
ruby = <<-RUBY
|
9
|
+
before do
|
10
|
+
f = File.basename("#{caller[0].split(':').first}")
|
11
|
+
f = "#{app.views}/" + f.sub('_spec.rb','')
|
12
|
+
puts f
|
13
|
+
@view_nodes = Nokogiri::HTML.fragment(File.read(f))
|
14
|
+
end
|
15
|
+
|
16
|
+
def ruhl_view
|
17
|
+
@view_nodes
|
18
|
+
end
|
19
|
+
|
20
|
+
def data_ruhl(path)
|
21
|
+
tag = ruhl_view.css(path).first
|
22
|
+
unless tag
|
23
|
+
raise Spec::Matchers::MatcherError.new("CSS selector: "+ path + " not found")
|
24
|
+
end
|
25
|
+
tag.attribute('data-ruhl').to_s
|
26
|
+
end
|
27
|
+
RUBY
|
28
|
+
|
29
|
+
parent.class_eval ruby
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/ruhl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruhl}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.19.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Stone"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-30}
|
13
13
|
s.description = %q{Make your HTML dynamic with the addition of a data-ruhl attribute.}
|
14
14
|
s.email = %q{andy@stonean.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/ruhl/rails/active_record.rb",
|
28
28
|
"lib/ruhl/rails/helper.rb",
|
29
29
|
"lib/ruhl/rails/ruhl_presenter.rb",
|
30
|
+
"lib/ruhl/rspec/rails.rb",
|
31
|
+
"lib/ruhl/rspec/sinatra.rb",
|
30
32
|
"lib/ruhl/sinatra.rb",
|
31
33
|
"ruhl.gemspec",
|
32
34
|
"spec/html/basic.html",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruhl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-30 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,6 +52,8 @@ files:
|
|
52
52
|
- lib/ruhl/rails/active_record.rb
|
53
53
|
- lib/ruhl/rails/helper.rb
|
54
54
|
- lib/ruhl/rails/ruhl_presenter.rb
|
55
|
+
- lib/ruhl/rspec/rails.rb
|
56
|
+
- lib/ruhl/rspec/sinatra.rb
|
55
57
|
- lib/ruhl/sinatra.rb
|
56
58
|
- ruhl.gemspec
|
57
59
|
- spec/html/basic.html
|