Sha256: a83a7bfdb61be60a5012d791be3f5246a5eac4e369acb992e1fa515f65c072cf
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require_relative '../spec_helper' require_relative '../make_db' require 'wlog/domain/log_entry' require 'wlog/domain/issue' include Wlog describe LogEntry do db_name = 'default' db_path = standard_db_path(db_name) before(:all) do make_testing_db(db_name) @issue = Issue.new @issue.description = "Attach logs to me!" @issue.save end after(:all) do FileUtils.rm db_path end it "should be inserted" do le = LogEntry.new desc = "This is a log description" le.description = desc @issue.log_entries << le other = @issue.log_entries.first expect(other.description).to eq(desc) expect(other.issue_id).to eq(@issue.id) end it "should handle something that is not found properly" do le = LogEntry.find_by_id(12123123123) expect(le).to eq(nil) end it "should not be inserted more than once" do previous = LogEntry.count le = LogEntry.new le.description = "derp" le.issue_id = @issue.id 4.times{ le.save } after = LogEntry.count expect(after).to eq(previous + 1) end it "should be deleted from the issue" do le = LogEntry.new le.description = "derp derp derp" le.issue_id = @issue.id le.save id = le.id LogEntry.delete(id) check = LogEntry.find_by_id(id) expect(check).to eq(nil) end it "should update to new information" do le = LogEntry.new(@db) before = "derp" after = "herp" le.description = before le.issue_id = @issue.id le.save le.description = after le.save check = LogEntry.find(le.id) expect(check.description).to eq(after) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wlog-1.2.2 | spec/domain/log_entry_spec.rb |