correct indentation and use new hash syntax

This commit is contained in:
zaziemo 2015-07-13 17:41:48 +02:00 committed by Dennis Schubert
parent fccb5dae23
commit e3fe375849
6 changed files with 22 additions and 26 deletions

View file

@ -5,8 +5,8 @@
require 'spec_helper' require 'spec_helper'
describe AccountDeletion, :type => :model do describe AccountDeletion, :type => :model do
let(:ad_new) { AccountDeletion.new(:person => alice.person) } let(:ad_new) { AccountDeletion.new(person: alice.person) }
let(:ad_create) { AccountDeletion.create(:person => alice.person) } let(:ad_create) { AccountDeletion.create(person: alice.person) }
it 'assigns the diaspora_handle from the person object' do it 'assigns the diaspora_handle from the person object' do
expect(ad_new.diaspora_handle).to eq(alice.person.diaspora_handle) expect(ad_new.diaspora_handle).to eq(alice.person.diaspora_handle)
@ -18,9 +18,8 @@ describe AccountDeletion, :type => :model do
end end
describe "#perform!" do describe "#perform!" do
it 'creates a deleter' 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! ad_new.perform!
end end
@ -30,7 +29,7 @@ describe AccountDeletion, :type => :model do
end end
it 'does not dispatch an account deletion for non-local people' do 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) expect(deletion).not_to receive(:dispatch)
deletion.perform! deletion.perform!
end end
@ -60,9 +59,9 @@ describe AccountDeletion, :type => :model do
end end
it 'includes remote resharers' do it 'includes remote resharers' do
sm = FactoryGirl.create( :status_message, :public => true, :author => alice.person) sm = FactoryGirl.create( :status_message, public: true, author: alice.person)
FactoryGirl.create( :reshare, :author => remote_raphael, :root => sm) FactoryGirl.create( :reshare, author: remote_raphael, root: sm)
FactoryGirl.create( :reshare, :author => local_luke.person, :root => sm) FactoryGirl.create( :reshare, author: local_luke.person, root: sm)
expect(ad_new.subscribers(alice)).to eq([remote_raphael]) expect(ad_new.subscribers(alice)).to eq([remote_raphael])
end end

View file

@ -1,11 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe ActsAsTaggableOn::Tag, :type => :model do describe ActsAsTaggableOn::Tag, :type => :model do
subject(:tag) { ActsAsTaggableOn::Tag } subject(:tag) { ActsAsTaggableOn::Tag }
describe '.autocomplete' do describe '.autocomplete' do
let!(:tag_cats) { tag.create(:name => "cats") } let!(:tag_cats) { tag.create(name: "cats") }
it 'downcases the tag name' do it 'downcases the tag name' do
expect(tag.autocomplete("CATS")).to eq([tag_cats]) expect(tag.autocomplete("CATS")).to eq([tag_cats])

View file

@ -7,9 +7,9 @@ require 'spec_helper'
describe AspectMembership, :type => :model do describe AspectMembership, :type => :model do
describe '#before_destroy' 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(: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 before do
allow(am).to receive(:user).and_return(alice) allow(am).to receive(:user).and_return(alice)

View file

@ -9,24 +9,24 @@ describe Aspect, :type => :model do
let(:name) { alice.aspects.first.name } let(:name) { alice.aspects.first.name }
it 'does not allow duplicate names' do 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 end
it 'validates case insensitiveness on names' do 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 end
it 'has a 20 character limit on names' do 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) expect(aspect.valid?).to eq(false)
end end
it 'is able to have other users as contacts' do 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]) 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: alice.person.id)).to be_empty
expect(aspect.contacts.where(:person_id => eve.person.id)).not_to be_empty expect(aspect.contacts.where(person_id: eve.person.id)).not_to be_empty
expect(aspect.contacts.size).to eq(1) expect(aspect.contacts.size).to eq(1)
end end
@ -44,8 +44,8 @@ describe Aspect, :type => :model do
describe 'validation' do describe 'validation' do
it 'has no uniqueness of name between users' do it 'has no uniqueness of name between users' do
aspect = alice.aspects.create(:name => "New Aspect") aspect = alice.aspects.create(name: "New Aspect")
aspect2 = eve.aspects.create(:name => aspect.name) aspect2 = eve.aspects.create(name: aspect.name)
expect(aspect2).to be_valid expect(aspect2).to be_valid
end end
end end

View file

@ -3,8 +3,8 @@ require 'spec_helper'
describe Block, :type => :model do describe Block, :type => :model do
describe 'validations' do describe 'validations' do
it 'doesnt allow you to block yourself' 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) expect(block.errors[:person_id].size).to eq(1)
end end
end end
end end

View file

@ -6,13 +6,11 @@ require 'spec_helper'
require Rails.root.join("spec", "shared_behaviors", "relayable") require Rails.root.join("spec", "shared_behaviors", "relayable")
describe Comment, :type => :model do describe Comment, :type => :model do
let(:alices_aspect) { alice.aspects.first } 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?") } let(:comment_alice) { alice.comment!(status_bob, "why so formal?") }
describe 'comment#notification_type' do describe 'comment#notification_type' do
it "returns 'comment_on_post' if the comment is on a post you own" 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) expect(comment_alice.notification_type(bob, alice.person)).to eq(Notifications::CommentOnPost)
end end