Last active
December 21, 2015 10:09
-
-
Save jianbo/6289664 to your computer and use it in GitHub Desktop.
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
require 'spec_helper' | |
describe "Search", :js => true, :search => true do | |
subject { page } | |
before(:all) do | |
max_user_id = User.maximum("id") | |
max_user_id = max_user_id.nil? ? 0 : max_user_id | |
user1 = User.create! :first_name => "Alexander", :last_name => "Elizabeth", :gender => "m", :birth_date => Time.now - 20.years, :country => "United States", :username => "user#{max_user_id + 1}", :email => "user#{max_user_id + 1}@example.com", :password => 'please', :password_confirmation => 'please', :avatar => 'ToonHeroBlack.jpg' | |
user1.confirm! | |
puts 'New user created: ' << user1.username | |
test_icon_s3_path = 'https://s3.amazonaws.com/projectassetsdevelopment/F3A290FA-6616-47D2-91EB-20F7482F49BF/F3A290FA-6616-47D2-91EB-20F7482F49BF.png' | |
toon1 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 1', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon2 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon3 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon4 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon5 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon6 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon7 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon8 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
toon9 = Toon.create!(:uuid => "AAA-BBB#{rand(10000)}", :name => 'Test Toon #{user1.id} - 2', :author => 'Alexander Hanson', | |
:json => %{[some json two]}, :icon_s3_path => test_icon_s3_path, :user_id => user1.id, :toon_type => "animation"); | |
@user = create(:user) | |
end | |
after(:all) do | |
Toon.delete_all | |
end | |
describe "search page" do | |
it { | |
Toon.reindex | |
sleep 3 | |
fill_in "search-sidenav", with: "Alexander" | |
page.execute_script("$('#search-form').submit()") | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment