Here's what I ended up doing to test my models. Other thoughts and ideas are welcome (like a shared example to use on all account scoped models based on this gist)
ruby
let(:account1) { create(:account) }
let(:account2) { create(:account) }
let(:transaction1) { create(:transaction, account: account1, user: account1.owner) }
let(:transaction2) { create(:transaction, account: account2, user: account2.owner) }
describe "default scope"do
context "query with no account set"do
it "returns an empty array"do
expect(Transaction.all).to be_empty
endend
context "query in account1"do
it "returns only account1's transaction"doAccount.current_id = account1.id
expect(Transaction.all).to eq [transaction1]
endend
context "query in account2"do
it "returns only account2's transaction"doAccount.current_id = account2.id
expect(Transaction.all).to eq [transaction2]
endendend
Also looking for an answer as to how I can allow for multiple uploads attached to one object (nested attributes). Although its been asked about 20 times already...I'll ask it again, has anyone found a solution?
Here's what I ended up doing to test my models. Other thoughts and ideas are welcome (like a shared example to use on all account scoped models based on this gist)
The answer is:
.join(" ").html_safe
+1
Same here. Hit a dead end because of this.
Also looking for an answer as to how I can allow for multiple uploads attached to one object (nested attributes). Although its been asked about 20 times already...I'll ask it again, has anyone found a solution?
I'm getting this one as well. Does anyone know how to address this?
I'm trying to run:
task :set_file_permissions do
run "chmod -R 777 #{release_path}/public/uploads"
run "chmod -R 0666 #{release_path}/log/production.log"
end
Getting the same errors as above.
Has anyone figured out how to insert a new line in a cell using the Microsoft XML approach?
+1. Thanks.