Sha256: fd4c7c945d7e0d10c9483bda7b6387afc4ca8b257b749844f520f7db50f9d38c
Contents?: true
Size: 931 Bytes
Versions: 2
Compression:
Stored size: 931 Bytes
Contents
require 'spec_helper' describe Promotion::Rules::User do let(:rule) { Promotion::Rules::User.new } context "#eligible?(order)" do let(:order) { Order.new } it "should be eligible if users are not provided" do users = mock("users", :none? => true) rule.stub(:users => users) rule.should be_eligible(order) end it "should be eligible if users include user placing the order" do user = mock_model(User) users = [user, mock_model(User)] users.stub(:none? => false) rule.stub(:users => users) order.stub(:user => user) rule.should be_eligible(order) end it "should not be eligible if user placing the order is not listed" do order.stub(:user => mock_model(User)) users = [mock_model(User), mock_model(User)] users.stub(:none? => false) rule.stub(:users => users) rule.should_not be_eligible(order) end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
MyCommerceapi-1.0.0 | promo/spec/models/promotion/rules/user_spec.rb |
MyCommerce-0.0.3 | promo/spec/models/promotion/rules/user_spec.rb |