Skip to content

Commit

Permalink
Fixes specs
Browse files Browse the repository at this point in the history
  • Loading branch information
flov committed Jan 12, 2020
1 parent cf87fa6 commit 0a236a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@

describe "#location_updated_at" do
it 'should not change if the location does not change' do
user.save!
location_updated_at = user.location_updated_at
user.save!
user.save
expect(user.location_updated_at).to eq(location_updated_at)
end
end
Expand All @@ -50,12 +49,14 @@
user.trips[0].rides << FactoryBot.build(:ride, :gender => 'male')
user.trips[0].rides << FactoryBot.build(:ride, :gender => 'female')
user.trips[0].rides << FactoryBot.build(:ride, :gender => 'mixed')
user.save
expect(user.genders).to eq(['male', 'female', 'mixed'])
expect(user.genders_in_percentage).to eq({'male' => 0.33, 'female' => 0.33, 'mixed' => 0.33})
end

it "only male driver" do
user.trips[0].rides << FactoryBot.build(:ride, :gender => 'male')
user.save
expect(user.genders_in_percentage).to eq({'male' => 1.0})
end
end
Expand Down Expand Up @@ -130,6 +131,7 @@
user.trips[0].rides << FactoryBot.build(:ride, vehicle: 'car')
user.trips[0].rides << FactoryBot.build(:ride, vehicle: 'car')
user.trips[0].rides << FactoryBot.build(:ride, vehicle: 'truck')
user.save
end

it 'returns the vehicles that the user has hitchhiked with' do
Expand Down
6 changes: 4 additions & 2 deletions spec/presenters/data_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@

it 'should return the json for a google chart DataTable' do
expect(DataPresenter.new.hitchhikers_with_most_stories).to eq(
[{username: 'flohfish', stories: 1},
{username: 'supertramp', stories: 1}])
[
{username: 'supertramp', stories: 1},
{username: 'flohfish', stories: 1}
])
end
end
end
Expand Down

0 comments on commit 0a236a1

Please sign in to comment.