Code Monkey home page Code Monkey logo

Comments (6)

icy-arctic-fox avatar icy-arctic-fox commented on May 24, 2024 1

The pending keyword works the same as it does in Crystal's Spec. Just replace it with pending to mark a single test as pending.

context "foo" do
  it "bar" do
  end
end

becomes:

context "foo" do
  pending "bar" do
  end
end

Are you trying to mark an entire group (context) as pending? That isn't supported as of now, but is planned.

How is this for new documentation?


Individual test cases can be skipped by using the pending keyword in place of it.
If preferred, skip and xit can also be used, which are used by RSpec.

require "./spec_helper"

Spectator.describe Nil do
  # Skip this test.
  # To run, change back to `it`.
  pending "this is skipped" do
    expect(true).to be_false
  end

  xit "so is this" do
    expect(true).to be_false
  end
end

The tests in the code above will not run.
This can be useful to stub tests for features that are not complete.

Groups of tests can't be skipped yet.
This is a planned future feature.

from spectator.

postmodern avatar postmodern commented on May 24, 2024

I was trying to wrap a it block with a pending block, where the pending description explains why it's marked pending, thus preserving the it description and the expect logic. I ended up using xits to skip the various tests.
https://github.com/postmodern/v4l2.cr/blob/master/spec/device_spec.cr

from spectator.

icy-arctic-fox avatar icy-arctic-fox commented on May 24, 2024

Ah, I see. That would be nice to have. I'll see what I can do.

from spectator.

icy-arctic-fox avatar icy-arctic-fox commented on May 24, 2024

I'm thinking of adding the following syntax to the next minor release:

pending "skipped for reasons" do
  it "does a thing" do
    # ...
  end

  context "something else" do
    it "does another thing" do
      # ...
    end
  end
end

Syntax from RSpec for pending and skipped example will be added as well:
https://relishapp.com/rspec/rspec-core/v/3-9/docs/pending-and-skipped-examples/pending-examples
https://relishapp.com/rspec/rspec-core/v/3-9/docs/pending-and-skipped-examples/skip-examples

Does this satisfy your use cases?

from spectator.

postmodern avatar postmodern commented on May 24, 2024

FYI pending inside of it would also be acceptable, as it's identical to RSpec 3's syntax.

it "should do thing" do
  pending "still need to fix this"

  expect(subject.foo).to be == bar
end

from spectator.

icy-arctic-fox avatar icy-arctic-fox commented on May 24, 2024

House keeping 🛎️ Please reopen if this issue hasn't been addressed or suits your needs.

Spectator v0.10 allows pending and skip inside of an example block. This matches RSpec. An x can be placed in front of a group (xcontext or xdescribe) and examples (xit) to skip the block. Also, a :pending or :skip tag can be added to groups and examples to do something similar.

This syntax (pending as a group) isn't possible and probably won't be made possible:

pending "group" do
  it "does a thing" do
    # ...
  end
end

from spectator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.