diff --git a/spec/models/account_deletion_spec.rb b/spec/models/account_deletion_spec.rb index a4a4c0d56..2a3d682a8 100644 --- a/spec/models/account_deletion_spec.rb +++ b/spec/models/account_deletion_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' describe AccountDeletion, :type => :model do - let(:ad_new) { AccountDeletion.new(:person => alice.person) } - let(:ad_create) { AccountDeletion.create(:person => alice.person) } + let(:ad_new) { AccountDeletion.new(person: alice.person) } + let(:ad_create) { AccountDeletion.create(person: alice.person) } it 'assigns the diaspora_handle from the person object' do expect(ad_new.diaspora_handle).to eq(alice.person.diaspora_handle) @@ -18,9 +18,8 @@ describe AccountDeletion, :type => :model do end describe "#perform!" do - it 'creates a deleter' do - expect(AccountDeleter).to receive(:new).with(alice.person.diaspora_handle).and_return(double(:perform! => true)) + expect(AccountDeleter).to receive(:new).with(alice.person.diaspora_handle).and_return(double(perform!: true)) ad_new.perform! end @@ -30,7 +29,7 @@ describe AccountDeletion, :type => :model do end it 'does not dispatch an account deletion for non-local people' do - deletion = AccountDeletion.new(:person => remote_raphael) + deletion = AccountDeletion.new(person: remote_raphael) expect(deletion).not_to receive(:dispatch) deletion.perform! end @@ -60,9 +59,9 @@ describe AccountDeletion, :type => :model do end it 'includes remote resharers' do - sm = FactoryGirl.create( :status_message, :public => true, :author => alice.person) - FactoryGirl.create( :reshare, :author => remote_raphael, :root => sm) - FactoryGirl.create( :reshare, :author => local_luke.person, :root => sm) + sm = FactoryGirl.create( :status_message, public: true, author: alice.person) + FactoryGirl.create( :reshare, author: remote_raphael, root: sm) + FactoryGirl.create( :reshare, author: local_luke.person, root: sm) expect(ad_new.subscribers(alice)).to eq([remote_raphael]) end diff --git a/spec/models/acts_as_taggable_on_tag_spec.rb b/spec/models/acts_as_taggable_on_tag_spec.rb index 259027d94..0d6d47981 100644 --- a/spec/models/acts_as_taggable_on_tag_spec.rb +++ b/spec/models/acts_as_taggable_on_tag_spec.rb @@ -1,11 +1,10 @@ require 'spec_helper' describe ActsAsTaggableOn::Tag, :type => :model do - subject(:tag) { ActsAsTaggableOn::Tag } describe '.autocomplete' do - let!(:tag_cats) { tag.create(:name => "cats") } + let!(:tag_cats) { tag.create(name: "cats") } it 'downcases the tag name' do expect(tag.autocomplete("CATS")).to eq([tag_cats]) diff --git a/spec/models/aspect_membership_spec.rb b/spec/models/aspect_membership_spec.rb index 1f9694670..97c5f7c77 100644 --- a/spec/models/aspect_membership_spec.rb +++ b/spec/models/aspect_membership_spec.rb @@ -7,9 +7,9 @@ require 'spec_helper' describe AspectMembership, :type => :model do describe '#before_destroy' do - let(:aspect) { alice.aspects.create(:name => "two") } + let(:aspect) { alice.aspects.create(name: "two") } let(:contact) { alice.contact_for(bob.person) } - let(:am) { alice.aspects.where(:name => "generic").first.aspect_memberships.first } + let(:am) { alice.aspects.where(name: "generic").first.aspect_memberships.first } before do allow(am).to receive(:user).and_return(alice) diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb index 301a7d3a4..7e247d405 100644 --- a/spec/models/aspect_spec.rb +++ b/spec/models/aspect_spec.rb @@ -9,24 +9,24 @@ describe Aspect, :type => :model do let(:name) { alice.aspects.first.name } it 'does not allow duplicate names' do - expect { alice.aspects.create(:name => name) }.not_to change(Aspect, :count) + expect { alice.aspects.create(name: name) }.not_to change(Aspect, :count) end it 'validates case insensitiveness on names' do - expect { alice.aspects.create(:name => name.titleize) }.not_to change(Aspect, :count) + expect { alice.aspects.create(name: name.titleize) }.not_to change(Aspect, :count) end it 'has a 20 character limit on names' do - aspect = Aspect.new(:name => "this name is really too too too too too long") + aspect = Aspect.new(name: "this name is really too too too too too long") expect(aspect.valid?).to eq(false) end it 'is able to have other users as contacts' do - aspect = alice.aspects.create(:name => 'losers') + aspect = alice.aspects.create(name: 'losers') - Contact.create(:user => alice, :person => eve.person, :aspects => [aspect]) - expect(aspect.contacts.where(:person_id => alice.person.id)).to be_empty - expect(aspect.contacts.where(:person_id => eve.person.id)).not_to be_empty + Contact.create(user: alice, person: eve.person, aspects: [aspect]) + expect(aspect.contacts.where(person_id: alice.person.id)).to be_empty + expect(aspect.contacts.where(person_id: eve.person.id)).not_to be_empty expect(aspect.contacts.size).to eq(1) end @@ -44,8 +44,8 @@ describe Aspect, :type => :model do describe 'validation' do it 'has no uniqueness of name between users' do - aspect = alice.aspects.create(:name => "New Aspect") - aspect2 = eve.aspects.create(:name => aspect.name) + aspect = alice.aspects.create(name: "New Aspect") + aspect2 = eve.aspects.create(name: aspect.name) expect(aspect2).to be_valid end end diff --git a/spec/models/block_spec.rb b/spec/models/block_spec.rb index e8b3683a6..2721ea1df 100644 --- a/spec/models/block_spec.rb +++ b/spec/models/block_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe Block, :type => :model do describe 'validations' do it 'doesnt allow you to block yourself' do - block = alice.blocks.create(:person => alice.person) + block = alice.blocks.create(person: alice.person) expect(block.errors[:person_id].size).to eq(1) end end -end \ No newline at end of file +end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 9a843c4d5..26ce4f7d9 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -6,13 +6,11 @@ require 'spec_helper' require Rails.root.join("spec", "shared_behaviors", "relayable") describe Comment, :type => :model do - let(:alices_aspect) { alice.aspects.first } - let(:status_bob) { bob.post(:status_message, :text => "hello", :to => bob.aspects.first.id) } + let(:status_bob) { bob.post(:status_message, text: "hello", to: bob.aspects.first.id) } let(:comment_alice) { alice.comment!(status_bob, "why so formal?") } describe 'comment#notification_type' do - it "returns 'comment_on_post' if the comment is on a post you own" do expect(comment_alice.notification_type(bob, alice.person)).to eq(Notifications::CommentOnPost) end