Sha256: e1b4cfd77c7bacf0f47ce2e6416684d1ed8f1d18ff543742f50051c41d138338

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

@passed = 0
@failures = []

def assert(value, message='Not true')
  if value
    @passed += 1
  else
    @failures << message
  end
end

def assert_equal(got, expected, message='Not equal')
  assert(got == expected, message)
end

describe 'Normal group' do
  it 'this should fail' do
    1.should == 2
  end
end

describe "New eql" do
  it "these should both pass" do
    1.should eq(1)
    1.should_not eq(2)
  end

  it "and this should fail" do
    1.should eq(:adam)
  end
end

describe Object do
  it "should output a nice name for classes" do
    1.should eq(1)
  end
end

describe 'Another group' do
  it 'this should pass' do
    1.should == 1
  end

  it 'this should fail' do
    raise "whatever error you like"
  end

  it 'this should pass' do
    true.should be_true
    false.should be_false
    nil.should be_nil
  end

  async 'this should pass (in 0.1 second time)' do
    set_timeout(100) do
      run_async {
        1.should == 1
      }
    end
  end

  async 'this should fail (in 0.1 second time)' do
    set_timeout(100) do
      run_async {
        1.should == 5
      }
    end
  end
end

Opal::Spec::Runner.autorun

puts "Assertions: #{@passed + @failures.length}, Passed: #{@passed}, Failures: #{@failures.length}"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-spec-0.2.10 spec/specs.rb
opal-spec-0.2.9 spec/specs.rb