Fix failing tests. Replace ruby to 2.1.1 in travis. Update travis config
This commit is contained in:
parent
eacdd9cfd6
commit
a6031df9f2
4 changed files with 65 additions and 54 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.1.0
|
- 2.1.1
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
@ -15,6 +15,5 @@ before_script:
|
||||||
- cp config/database.yml.example config/database.yml
|
- cp config/database.yml.example config/database.yml
|
||||||
- cp config/config.yml.example config/config.yml
|
- cp config/config.yml.example config/config.yml
|
||||||
- RAILS_ENV=test bundle exec rake db:migrate --trace
|
- RAILS_ENV=test bundle exec rake db:migrate --trace
|
||||||
- bundle exec rake db:test:prepare
|
|
||||||
script:
|
script:
|
||||||
- bundle exec rake spec
|
- bundle exec rspec --color --format documentation
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class Person < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :user, :inverse_of => :person
|
belongs_to :user, :inverse_of => :person
|
||||||
has_many :event_people, :dependent => :destroy
|
has_many :event_people, :dependent => :destroy
|
||||||
has_many :events, :through => :event_people, :uniq => true
|
has_many :events, -> { uniq }, :through => :event_people
|
||||||
has_many :registrations, :dependent => :destroy
|
has_many :registrations, :dependent => :destroy
|
||||||
has_many :votes, :dependent => :destroy
|
has_many :votes, :dependent => :destroy
|
||||||
has_many :voted_events, :through => :votes, :source => :events
|
has_many :voted_events, :through => :votes, :source => :events
|
||||||
|
|
|
||||||
|
|
@ -1,60 +1,72 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Conference do
|
describe Conference do
|
||||||
before do
|
|
||||||
@conference = create(:conference)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
let(:subject) { create(:conference) }
|
||||||
|
|
||||||
describe "#registration_open?" do
|
describe "#registration_open?" do
|
||||||
|
|
||||||
context "closed registration" do
|
context "closed registration" do
|
||||||
|
|
||||||
it "#registration_open? is false" do
|
it "#registration_open? is false" do
|
||||||
expect(@conference.registration_open?).to be false
|
expect(subject.registration_open?).to be false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "open registration" do
|
context "open registration" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@conference.registration_start_date = Date.today - 1
|
subject.registration_start_date = Date.today - 1
|
||||||
@conference.registration_end_date = Date.today + 7
|
subject.registration_end_date = Date.today + 7
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#registration_open? is true" do
|
it "#registration_open? is true" do
|
||||||
expect(@conference.registration_open?).to be true
|
expect(subject.registration_open?).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#cfp_open?" do
|
describe "#cfp_open?" do
|
||||||
|
|
||||||
context "closed cfp" do
|
context "closed cfp" do
|
||||||
|
|
||||||
it "#cfp_open? is false" do
|
it "#cfp_open? is false" do
|
||||||
expect(@conference.cfp_open?).to be false
|
expect(subject.cfp_open?).to be false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "open cfp" do
|
context "open cfp" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@cfp = create(:call_for_papers)
|
subject.call_for_papers = create(:call_for_papers)
|
||||||
@conference.call_for_papers = @cfp
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#registration_open? is true" do
|
it "#registration_open? is true" do
|
||||||
expect(@conference.cfp_open?).to be true
|
expect(subject.cfp_open?).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#user_registered?" do
|
describe "#user_registered?" do
|
||||||
before do
|
|
||||||
@user = create(:user)
|
let(:user) { create(:user) }
|
||||||
end
|
|
||||||
context "user not registered" do
|
context "user not registered" do
|
||||||
it "#user_registered? is false" do
|
it "#user_registered? is false" do
|
||||||
expect(@conference.user_registered? @user).to be false
|
expect(subject.user_registered? user).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "user registered" do
|
context "user registered" do
|
||||||
pending "isn't tested yet"
|
pending "isn't tested yet"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue