diff --git a/spec/author_list_spec.rb b/spec/author_list_spec.rb index 0f26e61..6c8d96e 100644 --- a/spec/author_list_spec.rb +++ b/spec/author_list_spec.rb @@ -1,52 +1,51 @@ require_relative 'spec_helper' -require 'minitest/spec' -require 'timecost' +require 'timecost/author_list' describe TimeCost::AuthorList do - let(:author_list) { TimeCost::AuthorList.new } - let(:author_first) { "foo@example.com" } - let(:author_second) { "bar@example.com" } + let(:list) { TimeCost::AuthorList.new } + let(:first) { "Foo " } + let(:second) { "Bar " } describe '.new' do it "can be created without arguments" do - assert_instance_of TimeCost::AuthorList, author_list + assert_instance_of TimeCost::AuthorList, list end end describe '.add' do it "must accept adding authors" do - assert_respond_to author_list, :add + assert_respond_to list, :add - author_list.add "foo@example.com" - author_list.add "bar@example.com" + list.add first + list.add second end it "must assign a different id to different authors" do - author_list.add "foo@example.com" - author_list.add "bar@example.com" - id_foo = author_list.parse "foo@example.com" - id_bar = author_list.parse "bar@example.com" + list.add first + list.add second + id_foo = list.parse first + id_bar = list.parse second refute_equal id_foo, id_bar end end describe '.alias' do it "must accept aliases for authors" do - assert_respond_to author_list, :alias + assert_respond_to list, :alias - author_list.add author_first - author_list.alias author_first, author_second + list.add first + list.alias first, second end it "must assign the same id to aliases authors" do - author_list.add author_first - author_list.alias author_first, author_second + list.add first + list.alias first, second - id_foo = author_list.parse author_first - id_bar = author_list.parse author_second + id_foo = list.parse first + id_bar = list.parse second refute_equal id_foo, id_bar end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f31447e..e208137 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,13 @@ #require 'mark' +# require 'minitest/unit' require 'minitest/autorun' +require 'minitest/spec' require 'minitest/pride' +$LOAD_PATH.unshift('../lib') + #if __FILE__ == $0 # $LOAD_PATH.unshift('lib', 'spec') # Dir.glob('./spec/**/*_spec.rb') { |f| require f }