Struct mrusty::Spec [] [src]

pub struct Spec {
    // some fields omitted
}

A struct useful for mruby spec definition and running.

Available matchers:

Examples

struct Cont;

impl MrubyFile for Cont {
    fn require(mruby: MrubyType) {
        mruby.def_class_for::<Cont>("Container");
    }
}

let mruby = Mruby::new();
Cont::require(mruby.clone());

let spec = Spec::new(mruby, "Container", "
    context 'when 1' do
      subject { 1 }

      it { is_expected.to eql 1 }
    end

    context 'when 1' do
      subject { 1 }
      let(:one) { 1 }

      it 'won\\'t' do
        expect(1).to eql one
      end
    end
");

assert_eq!(spec.run(), true);

Methods

impl Spec
[src]

fn new(mruby: MrubyType, name: &str, script: &str) -> Spec

Creates an mruby spec runner.

Examples

struct Cont;

impl MrubyFile for Cont {
    fn require(mruby: MrubyType) {
        mruby.def_class_for::<Cont>("Container");
    }
}

let mruby = Mruby::new();
Cont::require(mruby.clone());

let spec = Spec::new(mruby, "Container", "
    context 'when 1' do
      subject { 1 }

      it { is_expected.to eql 1 }
    end

    context 'when 1' do
      subject { 1 }
      let(:one) { 1 }

      it 'won\\'t' do
        expect(1).to eql one
      end
    end
");

fn run(&self) -> bool

Runs mruby specs.

Examples

struct Cont;

impl MrubyFile for Cont {
    fn require(mruby: MrubyType) {
        mruby.def_class_for::<Cont>("Container");
    }
}

let mruby = Mruby::new();
Cont::require(mruby.clone());

let spec = Spec::new(mruby, "Container", "
    context 'when 1' do
      subject { 1 }

      it { is_expected.to eql 1 }
    end

    context 'when 1' do
      subject { 1 }
      let(:one) { 1 }

      it 'won\\'t' do
        expect(1).to eql one
      end
    end
");

assert_eq!(spec.run(), true);