Skip to content

Commit

Permalink
Re wrote a few expects in model specs
Browse files Browse the repository at this point in the history
  • Loading branch information
amanelis committed Jan 24, 2013
1 parent 827cde1 commit 5409535
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
9 changes: 2 additions & 7 deletions spec/models/activity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

describe Activity do
describe "associations" do
it "should belong to user" do
should belong_to(:user)
end

it "should belong to channel" do
should belong_to(:channel)
end
it { should belong_to(:user) }
it { should belong_to(:channel) }
end
end
15 changes: 9 additions & 6 deletions spec/models/attachment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

describe Attachment do
describe "associations" do
it "should belong to channel" do
should belong_to(:channel)
end

it "should belong to user" do
should belong_to(:user)
it { should belong_to(:channel) }
it { should belong_to(:user) }
end

describe "#url" do
subject { double('attachment', url: 'some_string', file: 'file') }

it "should return a string file_name" do
expect(subject.url).to eq('some_string')
end
end
end
9 changes: 2 additions & 7 deletions spec/models/channel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

describe Channel do
describe "associations" do
it "should have many activities" do
should have_many(:activities)
end

it "should have many attachments" do
should have_many(:attachments)
end
it { should have_many(:activities) }
it { should have_many(:attachments) }
end

describe "user_connect" do
Expand Down
12 changes: 5 additions & 7 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

describe User do
describe "associations" do
it "should have many activities" do
should have_many(:activities)
end
it { should have_many(:activities) }
end

it "should have authentication token on creation" do
@user = FactoryGirl.create(:user)
@user.authentication_token.should_not be_nil
subject { @user.authentication_token }
expect(subject).to_not eq(nil)
end

it "should have gravatar hash on creation" do
@user = FactoryGirl.create(:user)
@user.gravatar_hash.should_not be_nil
subject { @user.gravatar_hash }
expect(subject).to_not eq(nil)
end
end

0 comments on commit 5409535

Please sign in to comment.