Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal-rspec
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2930f85f0bed
Choose a base ref
...
head repository: opal/opal-rspec
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1d3edd34b129
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 17, 2013

  1. Add very simple example

    adambeynon committed Nov 17, 2013

    Verified

    This commit was signed with the committer’s verified signature.
    skmcgrail Sean McGrail
    Copy the full SHA
    17e99f0 View commit details
  2. README for example

    adambeynon committed Nov 17, 2013

    Verified

    This commit was signed with the committer’s verified signature.
    skmcgrail Sean McGrail
    Copy the full SHA
    1d3edd3 View commit details
Showing with 51 additions and 0 deletions.
  1. +4 −0 example/Gemfile
  2. +13 −0 example/README.md
  3. +8 −0 example/Rakefile
  4. +11 −0 example/opal/user.rb
  5. +15 −0 example/spec/user_spec.rb
4 changes: 4 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'rake'
gem 'opal-rspec', :path => '../'
13 changes: 13 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# opal-spec example

Install dependencies:

```
bundle install
```

Run examples:

```
bundle exec rake
```
8 changes: 8 additions & 0 deletions example/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler'
Bundler.require

# Add our opal/ directory to the load path
Opal.append_path File.expand_path('../opal', __FILE__)

require 'opal/rspec/rake_task'
Opal::RSpec::RakeTask.new(:default)
11 changes: 11 additions & 0 deletions example/opal/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class User
attr_accessor :name

def initialize(name)
@name = name
end

def admin?
@name == 'Bob'
end
end
15 changes: 15 additions & 0 deletions example/spec/user_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'user'

describe User do
it '#initialize accepts a name' do
expect(User.new('Jim').name).to eq('Jim')
end

it 'is an admin if name is Bob' do
expect(User.new('Bob')).to be_admin
end

it 'is not an admin if name is not Bob' do
expect(User.new('Jim')).to_not be_admin
end
end