Skip to content

Instantly share code, notes, and snippets.

@NilsonLima
Last active July 3, 2020 13:44
Show Gist options
  • Save NilsonLima/c61538e6bf6acbae11aa5086e5381358 to your computer and use it in GitHub Desktop.
Save NilsonLima/c61538e6bf6acbae11aa5086e5381358 to your computer and use it in GitHub Desktop.
require "test_helper"
class Smartphone::Contract::ChangeDeviceTest < ActiveSupport::TestCase
setup do
@smartphone_contract = smartphone_contracts(:base_contract)
@params = { id: @smartphone_contract[:id], imei: '...', imei_secondary: '...', ... }
end
subject { Smartphone::Contract::ChangeDevice }
context "suspended" do
should "fail" do
#
end
end
context "not suspended" do
context "current device match previous" do
should "fail" do
#
end
end
context "current device mismatch previous" do
context "has pending invoices" do
should "fail" do
#
end
end
context "hasn't pending invoices" do
context "previous attributes are invalid" do
should "fail" do
#
end
end
context "previvous attributes are valid" do
context "new attributes are invalid" do
should "fail" do
#
end
end
context "new attributes are valid" do
context "not suspendable" do
should "fail" do
#
end
end
context "suspendable" do
context "certificate changing" do
should "fail if operation fails" do
#
end
context "happy path" do
should "return success if operation succeeds" do
#
end
end
end
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment