Move misc_spec.rb to spec/spec
spec/spec is a new folder for "tests for tests"
This commit is contained in:
parent
7374661e2f
commit
d8398caf2e
1 changed files with 16 additions and 12 deletions
|
|
@ -2,23 +2,23 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
describe 'making sure the spec runner works' do
|
describe "making sure the spec runner works" do
|
||||||
it 'factory creates a user with a person saved' do
|
it "factory creates a user with a person saved" do
|
||||||
user = FactoryGirl.create(:user)
|
user = FactoryGirl.create(:user)
|
||||||
loaded_user = User.find(user.id)
|
loaded_user = User.find(user.id)
|
||||||
expect(loaded_user.person.owner_id).to eq(user.id)
|
expect(loaded_user.person.owner_id).to eq(user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'fixtures' do
|
describe "fixtures" do
|
||||||
it 'loads fixtures' do
|
it "loads fixtures" do
|
||||||
expect(User.count).not_to eq(0)
|
expect(User.count).not_to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#connect_users" do
|
describe "#connect_users" do
|
||||||
before do
|
before do
|
||||||
@user1 = User.where(:username => 'alice').first
|
@user1 = User.where(username: "alice").first
|
||||||
@user2 = User.where(:username => 'eve').first
|
@user2 = User.where(username: "eve").first
|
||||||
|
|
||||||
@aspect1 = @user1.aspects.first
|
@aspect1 = @user1.aspects.first
|
||||||
@aspect2 = @user2.aspects.first
|
@aspect2 = @user2.aspects.first
|
||||||
|
|
@ -26,7 +26,7 @@ describe 'making sure the spec runner works' do
|
||||||
connect_users(@user1, @aspect1, @user2, @aspect2)
|
connect_users(@user1, @aspect1, @user2, @aspect2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'connects the first user to the second' do
|
it "connects the first user to the second" do
|
||||||
contact = @user1.contact_for @user2.person
|
contact = @user1.contact_for @user2.person
|
||||||
expect(contact).not_to be_nil
|
expect(contact).not_to be_nil
|
||||||
expect(@user1.contacts.reload.include?(contact)).to be true
|
expect(@user1.contacts.reload.include?(contact)).to be true
|
||||||
|
|
@ -34,7 +34,7 @@ describe 'making sure the spec runner works' do
|
||||||
expect(contact.aspects.include?(@aspect1)).to be true
|
expect(contact.aspects.include?(@aspect1)).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'connects the second user to the first' do
|
it "connects the second user to the first" do
|
||||||
contact = @user2.contact_for @user1.person
|
contact = @user2.contact_for @user1.person
|
||||||
expect(contact).not_to be_nil
|
expect(contact).not_to be_nil
|
||||||
expect(@user2.contacts.reload.include?(contact)).to be true
|
expect(@user2.contacts.reload.include?(contact)).to be true
|
||||||
|
|
@ -42,8 +42,8 @@ describe 'making sure the spec runner works' do
|
||||||
expect(contact.aspects.include?(@aspect2)).to be true
|
expect(contact.aspects.include?(@aspect2)).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows posting after running' do
|
it "allows posting after running" do
|
||||||
message = @user1.post(:status_message, :text => "Connection!", :to => @aspect1.id)
|
message = @user1.post(:status_message, text: "Connection!", to: @aspect1.id)
|
||||||
expect(@user2.reload.visible_shareables(Post)).to include message
|
expect(@user2.reload.visible_shareables(Post)).to include message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -71,13 +71,17 @@ describe 'making sure the spec runner works' do
|
||||||
describe "#post" do
|
describe "#post" do
|
||||||
it "creates a notification with a mention" do
|
it "creates a notification with a mention" do
|
||||||
expect {
|
expect {
|
||||||
alice.post(:status_message, :text => "@{Bob Grimn; #{bob.person.diaspora_handle}} you are silly", :to => alice.aspects.find_by_name('generic'))
|
alice.post(
|
||||||
|
:status_message,
|
||||||
|
text: "@{Bob Grimn; #{bob.person.diaspora_handle}} you are silly",
|
||||||
|
to: alice.aspects.find_by(name: "generic")
|
||||||
|
)
|
||||||
}.to change(Notification, :count).by(1)
|
}.to change(Notification, :count).by(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#create_conversation_with_message" do
|
describe "#create_conversation_with_message" do
|
||||||
it 'creates a conversation and a message' do
|
it "creates a conversation and a message" do
|
||||||
conversation = create_conversation_with_message(alice.person, bob.person, "Subject", "Hey Bob")
|
conversation = create_conversation_with_message(alice.person, bob.person, "Subject", "Hey Bob")
|
||||||
|
|
||||||
expect(conversation.participants).to eq([alice.person, bob.person])
|
expect(conversation.participants).to eq([alice.person, bob.person])
|
||||||
Loading…
Reference in a new issue