summaryrefslogtreecommitdiff
path: root/spec/ruby/library/erb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/erb')
-rw-r--r--spec/ruby/library/erb/def_class_spec.rb2
-rw-r--r--spec/ruby/library/erb/def_module_spec.rb3
-rw-r--r--spec/ruby/library/erb/defmethod/def_erb_method_spec.rb2
-rw-r--r--spec/ruby/library/erb/filename_spec.rb4
-rw-r--r--spec/ruby/library/erb/new_spec.rb8
-rw-r--r--spec/ruby/library/erb/result_spec.rb4
-rw-r--r--spec/ruby/library/erb/run_spec.rb4
7 files changed, 17 insertions, 10 deletions
diff --git a/spec/ruby/library/erb/def_class_spec.rb b/spec/ruby/library/erb/def_class_spec.rb
index 88bd385f4c..fb687531e0 100644
--- a/spec/ruby/library/erb/def_class_spec.rb
+++ b/spec/ruby/library/erb/def_class_spec.rb
@@ -24,6 +24,8 @@ END
MyClass1ForErb = erb.def_class(MyClass1ForErb_, 'render()')
MyClass1ForErb.method_defined?(:render).should == true
MyClass1ForErb.new('foo', 123).render().should == expected
+ ensure
+ Object.send(:remove_const, :MyClass1ForErb)
end
end
diff --git a/spec/ruby/library/erb/def_module_spec.rb b/spec/ruby/library/erb/def_module_spec.rb
index 806e564ef0..5f67aeb2b9 100644
--- a/spec/ruby/library/erb/def_module_spec.rb
+++ b/spec/ruby/library/erb/def_module_spec.rb
@@ -22,6 +22,9 @@ END
include MyModule2ForErb
end
MyClass2ForErb.new.render('foo', 123).should == expected
+ ensure
+ Object.send(:remove_const, :MyClass2ForErb)
+ Object.send(:remove_const, :MyModule2ForErb)
end
end
diff --git a/spec/ruby/library/erb/defmethod/def_erb_method_spec.rb b/spec/ruby/library/erb/defmethod/def_erb_method_spec.rb
index dc1e044d9c..1cd7582936 100644
--- a/spec/ruby/library/erb/defmethod/def_erb_method_spec.rb
+++ b/spec/ruby/library/erb/defmethod/def_erb_method_spec.rb
@@ -58,6 +58,8 @@ END
end
end
MyClass4ForErb.new([10,20,30]).render().should == expected
+ ensure
+ Object.send(:remove_const, :MY_INPUT4_FOR_ERB)
end
diff --git a/spec/ruby/library/erb/filename_spec.rb b/spec/ruby/library/erb/filename_spec.rb
index 8ecaed7343..bbd2233bb3 100644
--- a/spec/ruby/library/erb/filename_spec.rb
+++ b/spec/ruby/library/erb/filename_spec.rb
@@ -13,7 +13,7 @@ describe "ERB#filename" do
@ex = e
raise e
end
- }.should raise_error(SyntaxError)
+ }.should.raise(SyntaxError)
expected = filename
@ex.message =~ /^(.*?):(\d+): /
@@ -30,7 +30,7 @@ describe "ERB#filename" do
@ex = e
raise e
end
- }.should raise_error(SyntaxError)
+ }.should.raise(SyntaxError)
expected = '(erb)'
@ex.message =~ /^(.*?):(\d+): /
diff --git a/spec/ruby/library/erb/new_spec.rb b/spec/ruby/library/erb/new_spec.rb
index f721529ab0..35ac0dfdfe 100644
--- a/spec/ruby/library/erb/new_spec.rb
+++ b/spec/ruby/library/erb/new_spec.rb
@@ -83,7 +83,7 @@ END
-> {
ERBSpecs.new_erb(input, trim_mode: '-').result
- }.should raise_error(SyntaxError)
+ }.should.raise(SyntaxError)
end
it "regards lines starting with '%' as '<% ... %>' when trim_mode is '%'" do
@@ -136,11 +136,11 @@ END
it "forget local variables defined previous one" do
ERB.new(@eruby_str).result
- ->{ ERB.new("<%= list %>").result }.should raise_error(NameError)
+ ->{ ERB.new("<%= list %>").result }.should.raise(NameError)
end
- describe "warning about arguments" do
- version_is ERB.version, "2.2.1" do #ruby_version_is "3.1" do
+ version_is ERB.const_get(:VERSION, false), ""..."6.0.0" do
+ describe "warning about arguments" do
it "warns when passed safe_level and later arguments" do
-> {
ERB.new(@eruby_str, nil, '%')
diff --git a/spec/ruby/library/erb/result_spec.rb b/spec/ruby/library/erb/result_spec.rb
index a29c1ccedb..84333031ec 100644
--- a/spec/ruby/library/erb/result_spec.rb
+++ b/spec/ruby/library/erb/result_spec.rb
@@ -43,7 +43,7 @@ END
input = "<%=h '<>' %>"
-> {
ERB.new(input).result()
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
@@ -81,6 +81,6 @@ END
-> {
myerb2.new.main2()
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
end
diff --git a/spec/ruby/library/erb/run_spec.rb b/spec/ruby/library/erb/run_spec.rb
index 602e53ab38..d81d534087 100644
--- a/spec/ruby/library/erb/run_spec.rb
+++ b/spec/ruby/library/erb/run_spec.rb
@@ -54,7 +54,7 @@ END
input = "<%=h '<>' %>"
-> {
_steal_stdout { ERB.new(input).run() }
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
it "is able to h() or u() if ERB::Util is included" do
@@ -91,6 +91,6 @@ END
-> {
_steal_stdout { myerb2.new.main2() }
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
end