spec/rack/dev-mark/theme/base_spec.rb in rack-dev-mark-0.5.1 vs spec/rack/dev-mark/theme/base_spec.rb in rack-dev-mark-0.6.0
- old
+ new
@@ -7,11 +7,11 @@
}.to raise_error(Rack::DevMark::RuntimeError)
end
describe "subclass" do
subject { Class.new(Rack::DevMark::Theme::Base).new }
it "sets up" do
- subject.setup 'env', 'rev'
+ subject.setup 'env', 'rev', 'time'
expect(subject.env).to eq('env')
expect(subject.revision).to eq('rev')
end
describe "#gsub_tag_content" do
let(:input) { %Q|<body><h1>head</h1><a href="something">x</a><span></span>y</div>| }
@@ -21,9 +21,16 @@
end
context "for multiple tags" do
let(:input) { %Q|<body><h1>head</h1><a href="something">x</a><a href="anything">y</a></div>| }
let(:output) { %Q|<body><h1>head</h1><a href="something">replaced</a><a href="anything">replaced</a></div>| }
it "replaces a string" do
+ expect(subject.send(:gsub_tag_content, input, 'a', &lambda{ |v| 'replaced' })).to eq(output)
+ end
+ end
+ context "for nested tags" do
+ let(:input) { %Q|<body><h1>head</h1><a href="something"><span>x</span></a><span>y</span></div>| }
+ let(:output) { %Q|<body><h1>head</h1><a href="something"><span>x</span></a><span>y</span></div>| }
+ it "does not replace a string" do
expect(subject.send(:gsub_tag_content, input, 'a', &lambda{ |v| 'replaced' })).to eq(output)
end
end
end
describe "#gsub_tag_attribute" do