Sha256: 81c2ef3ed3a0d34083473c6ae68c180a91c85d852ccb74bb7ae6b2a1085c673c
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
shared_examples "noteable" do |noteable_type| let(:scope) { double } describe "#notes" do let(:fetch_scope) { double } it "passes the token and applies the params" do subject. should_receive(:pass_headers). with(BaseCrm::Note). and_return(scope) scope.should_receive(:params). with({ :noteable_type => noteable_type, :noteable_id => subject.id }).and_return(fetch_scope) subject.notes.should == fetch_scope end end describe "#notes.create" do let(:message) { mock } let(:note) { mock } let(:fetch_scope) { mock } it "passes the token and applies the params" do subject. should_receive(:pass_headers). with(BaseCrm::Note). and_return(scope) scope.should_receive(:params). with({ :noteable_type => noteable_type, :noteable_id => subject.id }).and_return(scope) scope.should_receive(:create).with({ :content => message, :noteable_type => noteable_type, :noteable_id => subject.id }).and_return(note) subject.notes.create(:content => message).should == note end end describe "#create_note" do let(:message) { mock } let(:notes) { mock } let(:note) { mock } it "creates a new note" do subject.should_receive(:notes).and_return(notes) notes.should_receive(:create).with({ :content => message }).and_return(note) subject.create_note(message).should == note end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
basecrm-0.1.0 | spec/support/noteable_shared_examples.rb |