From be49b0e4472afbc98c386f1c14afd1598ee14d16 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Tue, 29 Sep 2015 12:01:00 -0300 Subject: Refactor function spec --- spec/handlers/c/header/function_handler_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/handlers/c/header/function_handler_spec.rb b/spec/handlers/c/header/function_handler_spec.rb index ff1d2a8..1919fde 100644 --- a/spec/handlers/c/header/function_handler_spec.rb +++ b/spec/handlers/c/header/function_handler_spec.rb @@ -1,11 +1,12 @@ require_relative 'spec_helper' describe YARD::MRuby::Handlers::C::Header::FunctionHandler do + subject{ Registry.at('mrb_foo') } it "should register functions" do header_line <<-eof MRB_API void mrb_foo( void ); eof - expect(Registry.at('mrb_foo')).not_to be_nil + expect(subject).not_to be_nil end it "should find docstrings attached to functions" do @@ -14,8 +15,7 @@ describe YARD::MRuby::Handlers::C::Header::FunctionHandler do MRB_API void mrb_foo( void ); eof - foo = Registry.at('mrb_foo') - expect(foo.docstring).to eq 'DOCSTRING' + expect(subject.docstring).to eq 'DOCSTRING' end it "should store the return type" do @@ -23,8 +23,7 @@ describe YARD::MRuby::Handlers::C::Header::FunctionHandler do MRB_API mrb_value mrb_foo( void ); eof - foo = Registry.at('mrb_foo') - expect(foo.tag(:return).types).to eq ['mrb_value'] + expect(subject.tag(:return).types).to eq ['mrb_value'] end it "should keep return type independently from docs" do @@ -35,8 +34,8 @@ describe YARD::MRuby::Handlers::C::Header::FunctionHandler do MRB_API mrb_value mrb_foo( void ); eof - foo = Registry.at('mrb_foo') - expect(foo.tag(:return).text).to eq 'DOCSTRING' - expect(foo.tag(:return).types).to eq ['mrb_value'] + expect(subject.tag(:return).text).to eq 'DOCSTRING' + expect(subject.tag(:return).types).to eq ['mrb_value'] end + end -- cgit v1.2.3