Created
July 6, 2016 00:44
-
-
Save sameera207/55f5db2c44865f01187ee471328a36d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context 'buyer names changes' do | |
let(:name) { 'Lindt' } | |
let(:supplier) { Supplier.create(name: 'Cocoa Beans Inc', email: '[email protected]', password: 'password') } | |
let(:buyer) { Buyer.cretae(name: name, email: '[email protected]', password: 'password') } | |
subject { | |
FactoryGirl.create(:trade_request, buyer: buyer, supplier: supplier) | |
} | |
# go for a logical context name | |
context 'without buyer' do | |
it "creates an SP number from the first 4 letters from the client's name, then the first 4 letters from the supplier's name, then a sequential 3 digit number for each trade request with this combination of client and supplier, starting from an optional starting value" do | |
expect(subject.sp_number).to eq 'LINDCOCO101' | |
end | |
end | |
# go for a logical context name | |
context 'with buyer' do | |
let!(:name) { 'Cadbury' } | |
it "creates an SP number from the first 4 letters from the client's name, then the first 4 letters from the new supplier's name, and increments the sequential 3 digit number from the previous example" do | |
expect(subject.sp_number).to eq 'CADBCOCO102' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment