Sha256: c47cd3384ce691a6cf75ff350ef41313fab3559c656f8e0b31ac95c340fee391
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
require 'spec_helper' module ValidData describe Collector do let(:user_model) { double(name: 'User', count: 1) } let(:users) { [double(invalid?: true), double(invalid?: true), double(invalid?: false)] } let(:collector) { Collector.new([user_model]) } let(:result) { Result.new("User", 2, 3) } before do user_model.stub(:find_each).and_yield(users[0]).and_yield(users[1]).and_yield(users[2]) end describe "#compute_result" do it "returns a result object with the required information from the model" do expect(collector.compute_result(user_model)).to eq result end end describe "#each" do it "iterates over computed result for each model" do collector.each.to_a.should == [result] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
valid_data-0.0.1 | spec/lib/valid_data/collector_spec.rb |