सीखना कि कैसे 3 रुपये करना है। मेरे पास मैचर्स पर एक प्रश्न है। ट्यूटोरियल मैं अनुसरण कर रहा हूं क्यों कोड एक त्रुटि उत्पन्न कर रहा है, जबकि एक मैं बाहर टिप्पणी की मूल्यह्रास चेतावनी के साथ गुजर Rspec 2.रुपेक 3 बनाम रुपेक 2 मैटर्स
describe Team do
it "has a name" do
#Team.new("Random name").should respond_to :name
expect { Team.new("Random name") }.to be(:name)
end
it "has a list of players" do
#Team.new("Random name").players.should be_kind_of Array
expect { Team.new("Random name").players }.to be_kind_of(Array)
end
end
पर आधारित है।
त्रुटि
Failures:
1) Team has a name
Failure/Error: expect { Team.new("Random name") }.to be(:name)
You must pass an argument rather than a block to use the provided matcher (equal :name), or the matcher must implement `supports_block_expectations?`.
# ./spec/team_spec.rb:7:in `block (2 levels) in <top (required)>'
2) Team has a list of players
Failure/Error: expect { Team.new("Random name").players }.to be_kind_of(Array)
You must pass an argument rather than a block to use the provided matcher (be a kind of Array), or the matcher must implement `supports_block_expectations?`.
# ./spec/team_spec.rb:13:in `block (2 levels) in <top (required)>'
चेक इस [जवाब] (http://stackoverflow.com/questions/19960831/rspec-expect-vs-expect-with-block-whats-the-difference) _why? _ –