mutant 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/Changelog.md +5 -0
  4. data/TODO +0 -8
  5. data/config/flay.yml +1 -1
  6. data/config/reek.yml +4 -1
  7. data/lib/mutant.rb +1 -1
  8. data/lib/mutant/actor/env.rb +8 -8
  9. data/lib/mutant/actor/mailbox.rb +16 -31
  10. data/lib/mutant/actor/receiver.rb +7 -9
  11. data/lib/mutant/actor/sender.rb +3 -3
  12. data/lib/mutant/line_trace.rb +34 -0
  13. data/lib/mutant/reporter/cli.rb +17 -0
  14. data/lib/mutant/reporter/cli/format.rb +16 -17
  15. data/lib/mutant/reporter/cli/printer.rb +64 -17
  16. data/lib/mutant/reporter/trace.rb +12 -0
  17. data/lib/mutant/result.rb +3 -3
  18. data/lib/mutant/runner.rb +2 -5
  19. data/lib/mutant/runner/worker.rb +4 -6
  20. data/lib/mutant/subject.rb +23 -11
  21. data/lib/mutant/subject/method/instance.rb +3 -38
  22. data/lib/mutant/subject/method/singleton.rb +1 -1
  23. data/lib/mutant/version.rb +1 -1
  24. data/mutant.gemspec +1 -1
  25. data/spec/spec_helper.rb +2 -0
  26. data/spec/support/fake_actor.rb +17 -11
  27. data/spec/support/shared_context.rb +0 -2
  28. data/spec/unit/mutant/actor/env_spec.rb +5 -25
  29. data/spec/unit/mutant/actor/mailbox_spec.rb +29 -0
  30. data/spec/unit/mutant/actor/receiver_spec.rb +24 -28
  31. data/spec/unit/mutant/actor/sender_spec.rb +9 -9
  32. data/spec/unit/mutant/line_trace_spec.rb +38 -0
  33. data/spec/unit/mutant/reporter/cli_spec.rb +154 -157
  34. data/spec/unit/mutant/runner/master_spec.rb +11 -11
  35. data/spec/unit/mutant/runner/worker_spec.rb +2 -3
  36. data/spec/unit/mutant/runner_spec.rb +13 -10
  37. data/spec/unit/mutant/subject_spec.rb +17 -2
  38. metadata +51 -50
  39. data/lib/mutant/actor/actor.rb +0 -50
  40. data/spec/unit/mutant/actor/actor_spec.rb +0 -35
  41. data/spec/unit/mutant/mailbox_spec.rb +0 -33
@@ -1,50 +0,0 @@
1
- module Mutant
2
- module Actor
3
- # Actor object available to acting threads
4
- class Actor
5
- include Concord.new(:thread, :mailbox)
6
-
7
- # Initialize object
8
- #
9
- # @return [undefined]
10
- #
11
- # @api private
12
- #
13
- def initialize(*)
14
- super
15
- @sender = mailbox.sender(thread)
16
- end
17
-
18
- # Return sender to this actor
19
- #
20
- # @return [Sender]
21
- #
22
- # @api private
23
- #
24
- attr_reader :sender
25
-
26
- # Return receiver for messages to this actor
27
- #
28
- # @return [Receiver]
29
- #
30
- # @api private
31
- #
32
- def receiver
33
- mailbox.receiver
34
- end
35
-
36
- # Return binding for RPC to other actors
37
- #
38
- # @param [Actor::Sender] other
39
- #
40
- # @return [Binding]
41
- #
42
- # @api private
43
- #
44
- def bind(other)
45
- Binding.new(self, other)
46
- end
47
-
48
- end # Actor
49
- end # Actor
50
- end # Mutant
@@ -1,35 +0,0 @@
1
- RSpec.describe Mutant::Actor do
2
- let(:mutex) { double('Mutex') }
3
- let(:thread) { double('Thread') }
4
-
5
- before do
6
- expect(Mutex).to receive(:new).and_return(mutex)
7
- end
8
-
9
- describe Mutant::Actor::Actor do
10
- let(:mailbox) { Mutant::Actor::Mailbox.new }
11
-
12
- let(:object) { described_class.new(thread, mailbox) }
13
-
14
- describe '#bind' do
15
- let(:other) { double('Sender') }
16
-
17
- subject { object.bind(other) }
18
-
19
- it { should eql(Mutant::Actor::Binding.new(object, other)) }
20
- end
21
-
22
- describe '#sender' do
23
- subject { object.sender }
24
- it { should eql(Mutant::Actor::Sender.new(thread, mutex, [])) }
25
- end
26
-
27
- describe '#receiver' do
28
- subject { object.receiver }
29
-
30
- it 'returns receiver' do
31
- should eql(Mutant::Actor::Receiver.new(mutex, []))
32
- end
33
- end
34
- end
35
- end
@@ -1,33 +0,0 @@
1
- RSpec.describe Mutant::Actor::Mailbox do
2
- describe '.new' do
3
- subject { described_class.new }
4
-
5
- its(:frozen?) { should be(true) }
6
- end
7
-
8
- before do
9
- allow(Mutex).to receive(:new).and_return(mutex)
10
- end
11
-
12
- let(:mutex) { double('Mutex') }
13
- let(:object) { described_class.new }
14
- let(:thread) { double('Thread') }
15
-
16
- describe '#sender' do
17
- subject { object.sender(thread) }
18
-
19
- it { should eql(Mutant::Actor::Sender.new(thread, mutex, [])) }
20
- end
21
-
22
- describe '#receiver' do
23
- subject { object.receiver }
24
-
25
- it { should eql(Mutant::Actor::Receiver.new(mutex, [])) }
26
- end
27
-
28
- describe '#actor' do
29
- subject { object.actor(thread) }
30
-
31
- it { should eql(Mutant::Actor::Actor.new(thread, object)) }
32
- end
33
- end