spec/rspec/its_spec.rb in rspec-its-1.3.0 vs spec/rspec/its_spec.rb in rspec-its-1.3.1

- old
+ new

@@ -7,10 +7,11 @@ context "preserves described_class" do its(:symbol) { expect(described_class).to be Its } its([]) { expect(described_class).to be Its } end end + context "with explicit subject" do subject do Class.new do def initialize @call_count = 0 @@ -267,11 +268,10 @@ end end.new end its(:good) { will_not raise_error } - its(:bad) { will raise_error } its(:bad) { will raise_error(ArgumentError) } its(:bad) { will raise_error("message") } its(:bad) { will raise_error(ArgumentError, "message") } end @@ -372,9 +372,23 @@ its(:terminator) do expect { will_not be("back") }.to \ raise_error(ArgumentError, '`will_not` only supports block expectations') end + end + + context "when example is redefined" do + subject do + Class.new do + def will_still_work; true; end + end.new + end + + def self.example(*_args) + raise + end + + its(:will_still_work) { is_expected.to be true } end end end end