spec/lib/foederati/provider_spec.rb in foederati-0.1.0 vs spec/lib/foederati/provider_spec.rb in foederati-0.2.0

- old
+ new

@@ -4,10 +4,15 @@ subject { described_class.new(:new_provider).urls } it { is_expected.to respond_to :api } it { is_expected.to respond_to :site } end + describe '#default_params' do + subject { described_class.new(:new_provider).default_params } + it { is_expected.to respond_to :query } + end + describe '#results' do subject { described_class.new(:new_provider).results } it { is_expected.to respond_to :items } it { is_expected.to respond_to :total } end @@ -15,9 +20,26 @@ describe '#fields' do subject { described_class.new(:new_provider).fields } it { is_expected.to respond_to :title } it { is_expected.to respond_to :thumbnail } it { is_expected.to respond_to :url } + end + + describe '#name' do + subject { described_class.new(:new_provider) } + + context 'when not set' do + it 'is derived from ID' do + expect(subject.name).to eq('New Provider') + end + end + + context 'when set' do + it 'is returned as set' do + subject.name = 'Nice name' + expect(subject.name).to eq('Nice name') + end + end end describe '#initialize' do it 'evaluates a given block' do provider = described_class.new(:new_provider) do