1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
describe RSpec::Parameterized::Core::CompositeParser do
describe ".to_raw_source" do
subject { RSpec::Parameterized::Core::CompositeParser.to_raw_source(arg) }
context "arg is not proc" do
let(:arg) do
123
end
it { should eq "123" }
end
context "arg is proc" do
context "simple case" do
let(:arg) do
->(a) { a + 1 }
end
it { should eq "->(a) { a + 1 }" }
its(:encoding) { should eq Encoding::UTF_8 }
end
context "arg is multibyte characters" do
let(:arg) do
->(a) { a + "ほげほげ" }
end
it { should eq '->(a) { a + "ほげほげ" }' }
its(:encoding) { should eq Encoding::UTF_8 }
end
context "multiple lines" do
let(:arg) do
->(a) {
a +
1
}
end
it { should eq "->(a) {\n a +\n 1\n }" }
its(:encoding) { should eq Encoding::UTF_8 }
end
end
end
end
|