-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Action events #70
Action events #70
Changes from all commits
d07e537
c6125e8
ed18734
f9217b5
b4ac46b
44bbc93
fe39af9
97f8820
fd1bf88
42c1fbe
ad17ac9
b7ef6cd
40c1713
e21abf5
34b1870
9e0b74e
0a9eac4
f06e682
0197f13
b6f0f39
801e1a7
5632176
538b72a
26317ef
9aeb486
66ebbf0
a949f70
1098be3
e987a58
6626286
1a5df99
249ed12
c8928c6
64df038
16c729a
22d53a5
24f0289
aa3e36e
de767b8
9a15bac
cc08cfb
9a00cb8
6e77f75
c95b2bc
0c86ad2
8900c74
ab74e10
2b4c277
16cb73c
0fce9ad
0763616
dcc7045
14800e7
3e4fe46
1e85b22
cc9e816
13234a1
cab2b8c
c79d7fa
4053250
d1b8792
1ae9625
2908d25
05e3d68
7dbf109
387af72
6933dcc
9654f3a
ba4c533
258105c
6de8ee6
06f6018
b3e4b43
54539da
80b5447
752c188
4b622c4
2d6b8f3
0c0302f
339166c
6261454
dd47f44
0ced382
13f355d
acab66a
3d49dd7
2a15154
fc7e9bb
f9ea065
a2be064
79607fb
51a695a
3938637
eddaf3c
44be492
49af216
6c4f788
be9cdf2
f5a9768
07ec1b7
c13dc7f
f596cd4
f6dcf43
8b37052
916850d
478d517
d042845
cc4869f
680f294
e310f9f
55903c0
70247a9
c3ef881
bf592b4
701e933
5277c1e
2fcc4d5
29be35c
6eee0ca
fef61f3
ce7f8c4
c162a7a
26e6fd3
558ed23
46b0141
da1bdf4
900e6b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,5 @@ def repair_all | |
end | ||
|
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require File.expand_path('../spec_helper', File.dirname(__FILE__)) | ||
|
||
describe AdminController, "admin functions" do | ||
before do | ||
Account.as_bot do | ||
Card.search(:type => Card::UserID).each do |card| | ||
card.destroy | ||
end | ||
end | ||
end | ||
|
||
it "should setup be ready to setup" do | ||
post :setup, :account => {:email=>'admin@joe'} | ||
end | ||
|
||
it "should clear cache" do | ||
Account.as :joe_user do | ||
get :clear_cache | ||
end | ||
end | ||
|
||
it "should show cache" do | ||
Account.as :joe_user do | ||
get :show_cache, :id=>"A" | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require File.expand_path('../spec_helper', File.dirname(__FILE__)) | ||
include AuthenticatedTestHelper | ||
|
||
describe CardController, "location test from old integration" do | ||
|
||
include LocationHelper | ||
|
||
before do | ||
login_as 'joe_user' | ||
end | ||
|
||
it "should test_previous_location_should_be_assigned_after_viewing" do | ||
get :read, :id=>"Joe_User" | ||
assert_equal "/Joe_User", assigns['previous_location'] | ||
end | ||
|
||
it "should test_previous_location_should_not_be_updated_by_nonexistent_card" do | ||
get :read, :id=>"Joe_User" | ||
get :read, :id=>"Not_Me" | ||
get :read, :id=>'*previous' | ||
assert_redirected_to '/Joe_User' | ||
end | ||
|
||
it "should test_return_to_special_url_when_logging_in_after_visit" do | ||
# not sure this still tests the case, controller tests do not test routes | ||
get :read, :id=>'*recent' | ||
assert_equal "/*recent", assigns['previous_location'] | ||
end | ||
|
||
# FIXME: this should probably be files in the spot for a delete test | ||
it "should test_removal_and_return_to_previous_undeleted_card_after_deletion" do | ||
t1 = t2 = nil | ||
Account.as_bot do | ||
t1 = Card.create! :name => "Testable1", :content => "hello" | ||
t2 = Card.create! :name => "Testable1+bandana", :content => "world" | ||
end | ||
|
||
get :read, :id => t1.key | ||
get :read, :id => t2.key | ||
|
||
post :delete, :id=> '~'+t2.id.to_s | ||
assert_nil Card[ t2.name ] | ||
assert_redirected_to "/#{t1.name}" | ||
|
||
post :delete, :id => '~'+t1.id.to_s | ||
assert_redirected_to '/' | ||
assert_nil Card[ t1.name ] | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
|
||
require File.expand_path('../spec_helper', File.dirname(__FILE__)) | ||
include AuthenticatedTestHelper | ||
|
||
describe CardController do | ||
it "module exists and autoloads" do | ||
Wagn::Sets.should be_true | ||
end | ||
|
||
describe "read all set" do | ||
it "gets data" do | ||
get :read, :id=>'a' | ||
end | ||
end | ||
|
||
describe ".process_read" do | ||
before do | ||
end | ||
|
||
it "invokes actions on matching cards" do | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to fill in a few cases here ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't actually have any functionality here yet, right? I'm not totally clear on what we want in the realm of read-triggered actions yet. We should probably gather some use cases. Any in particular live for you? |
||
|
||
it "does not invoke actions on non-matching cards" do | ||
end | ||
|
||
it "invokes actions for set names" do | ||
|
||
end | ||
|
||
it "invokes multiple registered actions with arguments" do | ||
end | ||
end | ||
end | ||
|
||
|
||
describe CardController, "Basic rendering tests" do | ||
|
||
before do | ||
@sample_cards = Card.where("cards.key like 'sample_%' and cards.key not like '%+%'") | ||
end | ||
|
||
#these tests are increasingly lame. | ||
# how about we actually test for presense of a few things ? | ||
|
||
describe "for anonymous" do | ||
before do | ||
login_as :anonymous | ||
end | ||
|
||
it "should get changes for basic" do | ||
card = Card['Sample Basic'] | ||
card.new_card?.should be_false | ||
get :read, :id => "~#{card.id}", :view=>'changes' | ||
assert_response :success | ||
end | ||
|
||
it "should read all types" do | ||
@sample_cards.each do |sample| | ||
get :read, :id => "~#{sample.id}" | ||
assert_response :success | ||
end | ||
end | ||
|
||
it "should get options for all types" do | ||
@sample_cards.each do |sample| | ||
get :read, :id => "~#{sample.id}", :view=>'options' | ||
assert_response :success | ||
end | ||
end | ||
|
||
it "should get edit form for all types" do | ||
@sample_cards.each do |sample| | ||
get :read, :id => "~#{sample.id}", :view=>'edit' | ||
assert_response :forbidden | ||
end | ||
end | ||
|
||
it "should get new for basic" do | ||
get :read, :view=>'new' | ||
assert_response :forbidden | ||
end | ||
end | ||
|
||
describe "for joe user" do | ||
before do | ||
login_as 'Joe User' | ||
end | ||
|
||
it "should get changes for basic" do | ||
get :read, :id => "~#{Card['Sample Basic'].id}", :view=>'changes' | ||
assert_response :success | ||
end | ||
|
||
it "should read all types" do | ||
@sample_cards.each do |sample| | ||
get :read, :id => "~#{sample.id}" | ||
assert_response :success | ||
end | ||
end | ||
|
||
it "should get options for all types" do | ||
@sample_cards.each do |sample| | ||
get :read, :id => "~#{sample.id}", :view=>'options' | ||
assert_response :success | ||
end | ||
end | ||
|
||
it "should get edit form for all types" do | ||
@sample_cards.each do |sample| | ||
if %w{sample_html sample_layout}.member? sample.key | ||
login_as 'Joe Admin' do | ||
get :read, :id => "~#{sample.id}", :view=>'edit' | ||
end | ||
else | ||
get :read, :id => "~#{sample.id}", :view=>'edit' | ||
end | ||
response.should be_success, "Getting #{sample.inspect}" | ||
end | ||
end | ||
|
||
it "should get new for basic" do | ||
get :read, :id=>'', :view=>'new' | ||
assert_response :success | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) | ||
|
||
describe Card, "account functions" do | ||
before(:each) do | ||
Account.current_id= Card['joe_user'].id | ||
@auth_card = Account.current | ||
#warn "auth is #{@auth_card.inspect}" | ||
end | ||
|
||
it "should not show account for link on user's card (allready has an account)" do | ||
# render rules menu | ||
rendered = Wagn::Renderer::Html.new(@auth_card).render_options | ||
rendered.should_not match("Add a sign-in account for") | ||
end | ||
|
||
it "should not show account for link on another user's card (allready has an account)" do | ||
# render rules menu | ||
Account.current_id= Card['joe_admin'].id | ||
rendered = Wagn::Renderer::Html.new(@auth_card).render_options | ||
rendered.should_not match("Add a sign-in account for") | ||
end | ||
|
||
it 'should show for card without "accountable" on' do | ||
rendered = Wagn::Renderer::Html.new(Card['A']).render_options | ||
rendered.should_not match("Add a sign-in account for") | ||
end | ||
|
||
it 'should show for card with "accountable" on' do | ||
Account.as_bot do | ||
Card.create :name=>'A+*self+*accountable', :content=>'1' | ||
Card.create :name=>'*account+*right+*create', :content=>'[[Anyone Signed In]]' | ||
end | ||
rendered = Wagn::Renderer::Html.new(Card['A']).render_options | ||
rendered.should match("Add a sign-in account for") | ||
end | ||
|
||
it "should generate new password on forgotpassword" do | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue here was when we had the json renderer in a separate file (which I think we really want). I'm now thinking we should do a lot less auto loading, which could solve this. In any case, this is fine for now, because at least it's more consistent.