Skip to content

Instantly share code, notes, and snippets.

@AdrienBD
Created September 7, 2015 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdrienBD/1eb993716eebad9a918b to your computer and use it in GitHub Desktop.
Save AdrienBD/1eb993716eebad9a918b to your computer and use it in GitHub Desktop.
Empty diff in rspec test
describe 'self.index_download_stats' do
let(:stat_1) {Stat.create mobile_application_id: update_1.mobile_application.id,
store_id: store.id,
user_id: store.users[0].id,
mobile_application_update_id: update_1.id,
version: 1,
action: 'download',
created_at: 2.day.ago}
let(:stat_2) {Stat.create mobile_application_id: update_1.mobile_application.id,
store_id: store.id,
user_id: store.users[0].id,
mobile_application_update_id: update_1.id,
version: 1,
action: 'download',
created_at: 3.day.ago}
let(:stat_3) {Stat.create mobile_application_id: update_1.mobile_application.id,
store_id: store.id,
user_id: store.users[0].id,
mobile_application_update_id: update_1.id,
version: 1,
action: 'download',
created_at: 16.day.ago}
let(:json_1) {stat_1.as_json(except: [:_id, :indexed])}
let(:json_2) {stat_2.as_json(except: [:_id, :indexed])}
let(:json_3) {stat_3.as_json(except: [:_id, :indexed])}
before do
json_1['id'] = stat_1.id.to_s
json_2['id'] = stat_2.id.to_s
json_3['id'] = stat_3.id.to_s
end
before do
# prints to check time equality
p json_1['created_at'] == stat_1.created_at
p json_1['updated_at'] == stat_1.updated_at
end
before { expect(ElasticSearchUtils).to receive(:index_stat).with(:download, json_1).once }
subject { DownloadStatsService.index_download_stats }
it { subject }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment