Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to extend an expectation after it's created #13

Open
melcher opened this issue Jan 20, 2015 · 0 comments
Open

Be able to extend an expectation after it's created #13

melcher opened this issue Jan 20, 2015 · 0 comments

Comments

@melcher
Copy link
Member

melcher commented Jan 20, 2015

calling resource.expect creates an expectation, calling .with causes the expectation to pass/fail depending on those parameters, calling .with would chain the expected parameters so that each would need to pass.

  var expectation; // Instantiate it so it can be shared between calls
  beforeEach(function(){
    expectation = resource.expect('POST');
   // every it block now requires a post to happen
  });
  it("should expect a post", function(){
    // Fails because we don't click save
  });
  it("should succeed post happens with any parameters", function(){
      click('Create'); // succeeds with any parameters
  });
  context("with a name", function(){
    beforeEach(function(){
      expectation.with({name: 'Joey'}); // now requires the parameters {name: 'Joey'}
      fill('Name').with('Joey');
    });

    it("should send up the patient's name", function(){
      click('Create');
    });
    describe("with a phone number", function(){
      it("should send up the phone number", function(){
        fill('Phone number').with('415-555-1234');
        expectation.with({phone_number: '415-555-1234'});
        // Extends the expectation, now requires name: 'Joey' and phone_number:  '415-555-1234'
        click('Create');
      });
    });
  });
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant