This repository has been archived by the owner on Jul 31, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add some specs for example
- Loading branch information
1 parent
86b41d0
commit 57733de
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rake' | ||
gem 'opal', :github => 'opal/opal' | ||
gem 'opal-jquery', :github => 'opal/opal-jquery' | ||
gem 'vienna', :github => 'opal/vienna' | ||
gem 'opal-haml' | ||
gem 'opal-haml', :github => 'opal/opal-haml' | ||
gem 'opal-rspec', '0.3.0.beta2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'bundler' | ||
Bundler.require | ||
|
||
require 'opal/rspec/rake_task' | ||
Opal::RSpec::RakeTask.new(:default) do |s| | ||
s.append_path 'app' | ||
s.append_path 'vendor' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'opal' | ||
require 'vienna' | ||
require 'models/todo' | ||
|
||
RSpec.configure do |config| | ||
config.before { Todo.reset! } | ||
end | ||
|
||
describe Todo do | ||
before do | ||
@task_a = Todo.create(title: 'Foo', completed: true) | ||
@task_b = Todo.create(title: 'Bar', completed: false) | ||
@task_c = Todo.create(title: 'Baz', completed: true) | ||
@task_d = Todo.create(title: 'Buz', completed: false) | ||
end | ||
|
||
describe '.active' do | ||
it "returns all non-completed todos" do | ||
expect(Todo.active).to eq([@task_b, @task_d]) | ||
end | ||
end | ||
|
||
describe '.completed' do | ||
it "returns all completed todos" do | ||
expect(Todo.completed).to eq([@task_a, @task_c]) | ||
end | ||
end | ||
end |