mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
First tests in rspec, with factory_girl
This commit is contained in:
parent
accd7d1a58
commit
e3fd0c195a
11 changed files with 131 additions and 19 deletions
60
spec/models/conference_spec.rb
Normal file
60
spec/models/conference_spec.rb
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Conference do
|
||||
before do
|
||||
@conference = create(:conference)
|
||||
end
|
||||
|
||||
|
||||
describe "#registration_open?" do
|
||||
context "closed registration" do
|
||||
it "#registration_open? is false" do
|
||||
expect(@conference.registration_open?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context "open registration" do
|
||||
before do
|
||||
@conference.registration_start_date = Date.today - 1
|
||||
@conference.registration_end_date = Date.today + 7
|
||||
end
|
||||
it "#registration_open? is true" do
|
||||
expect(@conference.registration_open?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#cfp_open?" do
|
||||
context "closed cfp" do
|
||||
it "#cfp_open? is false" do
|
||||
expect(@conference.cfp_open?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context "open cfp" do
|
||||
before do
|
||||
@cfp = create(:call_for_papers)
|
||||
@conference.call_for_papers = @cfp
|
||||
end
|
||||
it "#registration_open? is true" do
|
||||
expect(@conference.cfp_open?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#user_registered?" do
|
||||
before do
|
||||
@user = create(:user)
|
||||
end
|
||||
context "user not registered" do
|
||||
it "#user_registered? is false" do
|
||||
expect(@conference.user_registered? @user).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context "user registered" do
|
||||
pending "isn't tested yet"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue