Commit c4945dbc34564819dca3de4844a1067cb44d36eb
1 parent
ef7dfc45
Exists in
master
and in
27 other branches
add functional tests to embed block support
Showing
2 changed files
with
32 additions
and
0 deletions
Show diff stats
app/controllers/embed_controller.rb
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | |
| 2 | + | |
| 3 | +class EmbedControllerTest < ActionController::TestCase | |
| 4 | + | |
| 5 | + def setup | |
| 6 | + login_as(create_admin_user(Environment.default)) | |
| 7 | + @block = LoginBlock.create! | |
| 8 | + @environment = Environment.default | |
| 9 | + @environment.boxes.create! | |
| 10 | + @environment.boxes.first.blocks << @block | |
| 11 | + end | |
| 12 | + | |
| 13 | + should 'be able to get embed block' do | |
| 14 | + get :index, :id => @block.id | |
| 15 | + assert_tag :tag => 'div', :attributes => { :id => "block-#{@block.id}" } | |
| 16 | + end | |
| 17 | + | |
| 18 | + should 'display error message when not found block' do | |
| 19 | + Block.delete_all | |
| 20 | + get :index, :id => 1 | |
| 21 | + assert_tag :tag => 'div', :attributes => { :id => "not-found" } | |
| 22 | + end | |
| 23 | + | |
| 24 | + should 'display error message when block is not visible/public' do | |
| 25 | + @block.display = 'never' | |
| 26 | + @block.save | |
| 27 | + get :index, :id => @block.id | |
| 28 | + assert_tag :tag => 'div', :attributes => { :id => "not-found" } | |
| 29 | + end | |
| 30 | + | |
| 31 | +end | ... | ... |