spec/unit/initialize_spec.rb in couch_potato-1.4.0 vs spec/unit/initialize_spec.rb in couch_potato-1.6.3

- old
+ new

@@ -1,38 +1,56 @@ require 'spec_helper' class Document include CouchPotato::Persistence - + property :title property :content end -describe "new" do - context "without arguments" do +describe 'new' do + context 'without arguments' do subject { Document.new } - it { should be_a(Document) } - its(:title) { should be_nil } - its(:content) { should be_nil } + it { is_expected.to be_a(Document) } + + it 'has no title' do + expect(subject.title).to be_nil + end + + it 'has no content' do + expect(subject.content).to be_nil + end end - context "with an argument hash" do - subject { Document.new(:title => 'My Title') } + context 'with an argument hash' do + subject { Document.new(title: 'My Title') } - it { should be_a(Document) } - its(:title) { should == 'My Title'} - its(:content) { should be_nil } + it { is_expected.to be_a(Document) } + + it 'has a title' do + expect(subject.title).to eql('My Title') + end + + it 'has no content' do + expect(subject.content).to be_nil + end end - context "yielding to a block" do - subject { - Document.new(:title => 'My Title') do |doc| + context 'yielding to a block' do + subject do + Document.new(title: 'My Title') do |doc| doc.content = 'My Content' end - } + end - it { should be_a(Document) } - its(:title) { should == 'My Title'} - its(:content) { should == 'My Content'} + it { is_expected.to be_a(Document) } + + it 'has a title' do + expect(subject.title).to eql('My Title') + end + + it 'has a content' do + expect(subject.content).to eql('My Content') + end end -end \ No newline at end of file +end