Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
dhp-venshop
dhp-venshop
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Hoang Phuc Do
  • dhp-venshopdhp-venshop
  • Merge Requests
  • !11

Merged
Opened Jul 04, 2017 by Hoang Phuc Do@phucdh 
  • Report abuse
Report abuse

[REVIEW] Update RSpec for model

  • Discussion 5
  • Commits 4
  • Changes 7
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Hoang Phuc Do @phucdh

    added 1 commit

    • 30a5b12f - Update RSpec for Product Item model

    Compare with previous version

    Jul 04, 2017

    added 1 commit

    • 30a5b12f - Update RSpec for Product Item model

    Compare with previous version

    added 1 commit * 30a5b12f - Update RSpec for Product Item model [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3450&start_sha=565db357b7e215a34eb94667ad6cececb73c6c90)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 1 commit

    • d2fa4e8c - Update RSpec for Product Item model

    Compare with previous version

    Jul 05, 2017

    added 1 commit

    • d2fa4e8c - Update RSpec for Product Item model

    Compare with previous version

    added 1 commit * d2fa4e8c - Update RSpec for Product Item model [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3451&start_sha=30a5b12f03257e751b12680b8aa2843daf34615f)
    Toggle commit list
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 05, 2017
    Resolved by Hoang Phuc Do Jul 05, 2017
    spec/models/order_spec.rb
    15 15 it { is_expected.to belong_to(:user) }
    16 16 it { is_expected.to have_many(:product_items) }
    17 17 end
    18
    19 context 'custom methods' do
    20 let(:user) { create(:user) }
    21 let!(:order) { create(:order, user: user) }
    22 let!(:product) { create(:product, quantity: 3, price: 10) }
    23 let!(:product_item) { create(:product_item, product: product, order: order) }
    24
    25 it 'has valid total_price' do
    26 expect(order.total_price).to eq 10
    • Trong Huu Nguyen @huunt commented Jul 05, 2017
      Master

      Please change expect(order.total_price).to eq 10 to expect(order.total_price).to eq product.price

      Edited Jul 05, 2017
      Please change `expect(order.total_price).to eq 10` to `expect(order.total_price).to eq product.price`
    • Hoang Phuc Do @phucdh

      changed this line in version 4 of the diff

      Jul 05, 2017

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3453&start_sha=d2fa4e8ca3d616874330e9303c8481832642047e#b7b00329aa0310c89016e90b7135025040255f5f_26_26)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 05, 2017
    Resolved by Hoang Phuc Do Jul 05, 2017
    spec/models/product_item_spec.rb
    15 15 it { is_expected.to belong_to(:order) }
    16 16 it { is_expected.to belong_to(:product) }
    17 17 end
    18
    19 context 'custom methods' do
    20 let!(:product) { create(:product, price: 10, quantity: 3) }
    21 let!(:product_item) { create(:product_item, product: product) }
    22
    23 it 'has valid total_price' do
    24 expect(product_item.total_price).to eq 10
    25 end
    26
    27 it 'has valid update_product_quantity' do
    28 product_item.update_product_quantity
    29 expect(product.quantity).to eq 2
    • Trong Huu Nguyen @huunt commented Jul 05, 2017
      Master

      Please change expect(product.quantity).to eq 2 2 is magic number

      Edited Jul 05, 2017
      Please change `expect(product.quantity).to eq 2` 2 is magic number
    • Hoang Phuc Do @phucdh

      changed this line in version 5 of the diff

      Jul 05, 2017

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3454&start_sha=8370453374225fb3fd3564a82369b0ad06d77d48#b6eef9f3f8c22d6f9beaba574997c2795a2d25bb_29_29)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 05, 2017
    Resolved by Hoang Phuc Do Jul 05, 2017
    spec/models/product_item_spec.rb
    15 15 it { is_expected.to belong_to(:order) }
    16 16 it { is_expected.to belong_to(:product) }
    17 17 end
    18
    19 context 'custom methods' do
    20 let!(:product) { create(:product, price: 10, quantity: 3) }
    21 let!(:product_item) { create(:product_item, product: product) }
    22
    23 it 'has valid total_price' do
    24 expect(product_item.total_price).to eq 10
    • Trong Huu Nguyen @huunt commented Jul 05, 2017
      Master

      10 is magic number. Please change it.

      Edited Jul 05, 2017
      10 is magic number. Please change it.
    • Hoang Phuc Do @phucdh

      changed this line in version 5 of the diff

      Jul 05, 2017

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3454&start_sha=8370453374225fb3fd3564a82369b0ad06d77d48#b6eef9f3f8c22d6f9beaba574997c2795a2d25bb_24_24)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 05, 2017
    Resolved by Hoang Phuc Do Jul 05, 2017
    spec/models/product_spec.rb
    21 21 it { is_expected.to belong_to(:user) }
    22 22 it { is_expected.to belong_to(:category) }
    23 23 end
    24
    25 context 'custom methods' do
    26 let!(:user) { create(:user) }
    27 let!(:other_user) { create(:user) }
    28 let!(:product) { create(:product, quantity: 3, user: user) }
    29
    30 it 'has valid in_stock?' do
    31 expect(product.in_stock?(2)).to be_truthy
    • Trong Huu Nguyen @huunt commented Jul 05, 2017
      Master

      2 is magic number.

      Edited Jul 05, 2017
      2 is magic number.
    • Hoang Phuc Do @phucdh

      changed this line in version 4 of the diff

      Jul 05, 2017

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3453&start_sha=d2fa4e8ca3d616874330e9303c8481832642047e#e7707be431a84e0dffbf971601b949677990c20d_31_30)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 05, 2017
    Resolved by Hoang Phuc Do Jul 05, 2017
    spec/models/product_spec.rb
    21 21 it { is_expected.to belong_to(:user) }
    22 22 it { is_expected.to belong_to(:category) }
    23 23 end
    24
    25 context 'custom methods' do
    26 let!(:user) { create(:user) }
    27 let!(:other_user) { create(:user) }
    28 let!(:product) { create(:product, quantity: 3, user: user) }
    29
    30 it 'has valid in_stock?' do
    31 expect(product.in_stock?(2)).to be_truthy
    32 end
    33
    34 it 'has invalid in_stock?' do
    35 expect(product.in_stock?(4)).not_to be_truthy
    • Trong Huu Nguyen @huunt commented Jul 05, 2017
      Master

      4 is magic number.

      Edited Jul 05, 2017
      4 is magic number.
    • Hoang Phuc Do @phucdh

      changed this line in version 4 of the diff

      Jul 05, 2017

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3453&start_sha=d2fa4e8ca3d616874330e9303c8481832642047e#e7707be431a84e0dffbf971601b949677990c20d_35_35)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do @phucdh

    added 1 commit

    • 83704533 - Fix merge request

    Compare with previous version

    Jul 05, 2017

    added 1 commit

    • 83704533 - Fix merge request

    Compare with previous version

    added 1 commit * 83704533 - Fix merge request [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3453&start_sha=d2fa4e8ca3d616874330e9303c8481832642047e)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 1 commit

    • d0280375 - Fix merge request

    Compare with previous version

    Jul 05, 2017

    added 1 commit

    • d0280375 - Fix merge request

    Compare with previous version

    added 1 commit * d0280375 - Fix merge request [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3454&start_sha=8370453374225fb3fd3564a82369b0ad06d77d48)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    resolved all discussions

    Jul 05, 2017

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 1 commit

    • eabf482e - Fix merge request

    Compare with previous version

    Jul 05, 2017

    added 1 commit

    • eabf482e - Fix merge request

    Compare with previous version

    added 1 commit * eabf482e - Fix merge request [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/11/diffs?diff_id=3455&start_sha=d02803759556dfa1f46e3946b47789885d890216)
    Toggle commit list
  • Trong Huu Nguyen @huunt

    mentioned in commit 03678484

    Jul 05, 2017

    mentioned in commit 03678484

    mentioned in commit 036784844fa96e3f440871f9d395387812f869dd
    Toggle commit list
  • Trong Huu Nguyen @huunt

    merged

    Jul 05, 2017

    merged

    merged
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Trong Huu Nguyen
Assignee
Trong Huu Nguyen @huunt
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: phucdh/dhp-venshop!11
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.